Merge "tests: Replace PHPUnit's loose assertEquals(null) with assertNull()"
[lhc/web/wiklou.git] / includes / api / ApiMove.php
index 0a788d4..74c6f8f 100644 (file)
@@ -59,13 +59,15 @@ class ApiMove extends ApiBase {
                }
                $toTalk = $toTitle->getTalkPageIfDefined();
 
+               $repoGroup = MediaWikiServices::getInstance()->getRepoGroup();
                if ( $toTitle->getNamespace() == NS_FILE
-                       && !RepoGroup::singleton()->getLocalRepo()->findFile( $toTitle )
-                       && MediaWikiServices::getInstance()->getRepoGroup()->findFile( $toTitle )
+                       && !$repoGroup->getLocalRepo()->findFile( $toTitle )
+                       && $repoGroup->findFile( $toTitle )
                ) {
-                       if ( !$params['ignorewarnings'] && $user->isAllowed( 'reupload-shared' ) ) {
+                       if ( !$params['ignorewarnings'] &&
+                                $this->getPermissionManager()->userHasRight( $user, 'reupload-shared' ) ) {
                                $this->dieWithError( 'apierror-fileexists-sharedrepo-perm' );
-                       } elseif ( !$user->isAllowed( 'reupload-shared' ) ) {
+                       } elseif ( !$this->getPermissionManager()->userHasRight( $user, 'reupload-shared' ) ) {
                                $this->dieWithError( 'apierror-cantoverwrite-sharedfile' );
                        }
                }
@@ -185,7 +187,7 @@ class ApiMove extends ApiBase {
                }
 
                // Check suppressredirect permission
-               if ( !$user->isAllowed( 'suppressredirect' ) ) {
+               if ( !$this->getPermissionManager()->userHasRight( $user, 'suppressredirect' ) ) {
                        $createRedirect = true;
                }
 
@@ -206,7 +208,7 @@ class ApiMove extends ApiBase {
                $mp = new MovePage( $fromTitle, $toTitle );
                $result =
                        $mp->moveSubpagesIfAllowed( $this->getUser(), $reason, !$noredirect, $changeTags );
-               if ( !$result->isOk() ) {
+               if ( !$result->isOK() ) {
                        // This means the whole thing failed
                        return [ 'errors' => $this->getErrorFormatter()->arrayFromStatus( $result ) ];
                }