X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiMove.php;h=74c6f8fccdb7a01870523d261934a31d272f7a9b;hb=543c5c1a1f985f3107ad1172933770bb761e54cf;hp=540860b3a9d9d622f34097cac18dd9403910de45;hpb=20d290b883bc79c975a852670a6ed10d8406896e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index 540860b3a9..74c6f8fccd 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -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' ); } } @@ -172,7 +174,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; @@ -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 ) ]; }