Merge "Make Special:ChangeContentModel field labels consistently use colons"
[lhc/web/wiklou.git] / includes / api / ApiMove.php
index 89ecc43..d8f48b8 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * API Module to move pages
  * @ingroup API
@@ -59,11 +61,12 @@ class ApiMove extends ApiBase {
 
                if ( $toTitle->getNamespace() == NS_FILE
                        && !RepoGroup::singleton()->getLocalRepo()->findFile( $toTitle )
-                       && wfFindFile( $toTitle )
+                       && MediaWikiServices::getInstance()->getRepoGroup()->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' );
                        }
                }
@@ -170,7 +173,7 @@ class ApiMove extends ApiBase {
         * @return Status
         */
        protected function movePage( Title $from, Title $to, $reason, $createRedirect, $changeTags ) {
-               $mp = new MovePage( $from, $to );
+               $mp = MediaWikiServices::getInstance()->getMovePageFactory()->newMovePage( $from, $to );
                $valid = $mp->isValidMove();
                if ( !$valid->isOK() ) {
                        return $valid;
@@ -183,7 +186,7 @@ class ApiMove extends ApiBase {
                }
 
                // Check suppressredirect permission
-               if ( !$user->isAllowed( 'suppressredirect' ) ) {
+               if ( !$this->getPermissionManager()->userHasRight( $user, 'suppressredirect' ) ) {
                        $createRedirect = true;
                }