Title: Title::getSubpage should not lose the interwiki prefix
[lhc/web/wiklou.git] / includes / api / ApiUndelete.php
index 840ef1b..ba9be81 100644 (file)
@@ -31,7 +31,8 @@ class ApiUndelete extends ApiBase {
                $params = $this->extractRequestParams();
 
                $user = $this->getUser();
-               if ( $user->isBlocked() ) {
+               $block = $user->getBlock();
+               if ( $block && $block->isSitewide() ) {
                        $this->dieBlocked( $user->getBlock() );
                }
 
@@ -40,7 +41,7 @@ class ApiUndelete extends ApiBase {
                        $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ] );
                }
 
-               if ( !$titleObj->userCan( 'undelete', $user, 'secure' ) ) {
+               if ( !$this->getPermissionManager()->userCan( 'undelete', $this->getUser(), $titleObj ) ) {
                        $this->dieWithError( 'permdenied-undelete' );
                }
 
@@ -84,8 +85,8 @@ class ApiUndelete extends ApiBase {
                $this->setWatch( $params['watchlist'], $titleObj );
 
                $info['title'] = $titleObj->getPrefixedText();
-               $info['revisions'] = intval( $retval[0] );
-               $info['fileversions'] = intval( $retval[1] );
+               $info['revisions'] = (int)$retval[0];
+               $info['fileversions'] = (int)$retval[1];
                $info['reason'] = $retval[2];
                $this->getResult()->addValue( null, $this->getModuleName(), $info );
        }