Merge "DifferenceEngine: show undo links for non-text content"
[lhc/web/wiklou.git] / includes / MovePage.php
index a63eeae..564c8f4 100644 (file)
@@ -25,7 +25,7 @@ use MediaWiki\Page\MovePageFactory;
 use MediaWiki\Permissions\PermissionManager;
 use MediaWiki\Revision\SlotRecord;
 use Wikimedia\Rdbms\IDatabase;
-use Wikimedia\Rdbms\LoadBalancer;
+use Wikimedia\Rdbms\ILoadBalancer;
 
 /**
  * Handles the backend logic of moving a page from one title
@@ -51,7 +51,7 @@ class MovePage {
        protected $options;
 
        /**
-        * @var LoadBalancer
+        * @var ILoadBalancer
         */
        protected $loadBalancer;
 
@@ -61,7 +61,7 @@ class MovePage {
        protected $nsInfo;
 
        /**
-        * @var WatchedItemStore
+        * @var WatchedItemStoreInterface
         */
        protected $watchedItems;
 
@@ -81,7 +81,7 @@ class MovePage {
         * @param Title $oldTitle
         * @param Title $newTitle
         * @param ServiceOptions|null $options
-        * @param LoadBalancer|null $loadBalancer
+        * @param ILoadBalancer|null $loadBalancer
         * @param NamespaceInfo|null $nsInfo
         * @param WatchedItemStore|null $watchedItems
         * @param PermissionManager|null $permMgr
@@ -90,9 +90,9 @@ class MovePage {
                Title $oldTitle,
                Title $newTitle,
                ServiceOptions $options = null,
-               LoadBalancer $loadBalancer = null,
+               ILoadBalancer $loadBalancer = null,
                NamespaceInfo $nsInfo = null,
-               WatchedItemStore $watchedItems = null,
+               WatchedItemStoreInterface $watchedItems = null,
                PermissionManager $permMgr = null,
                RepoGroup $repoGroup = null
        ) {
@@ -141,8 +141,9 @@ class MovePage {
                }
 
                $tp = $this->newTitle->getTitleProtection();
-               if ( $tp !== false && !$user->isAllowed( $tp['permission'] ) ) {
-                               $status->fatal( 'cantmove-titleprotected' );
+               $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+               if ( $tp !== false && !$permissionManager->userHasRight( $user, $tp['permission'] ) ) {
+                       $status->fatal( 'cantmove-titleprotected' );
                }
 
                Hooks::run( 'MovePageCheckPermissions',
@@ -351,7 +352,8 @@ class MovePage {
                }
 
                // Check suppressredirect permission
-               if ( !$user->isAllowed( 'suppressredirect' ) ) {
+               $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+               if ( !$permissionManager->userHasRight( $user, 'suppressredirect' ) ) {
                        $createRedirect = true;
                }
 
@@ -444,7 +446,7 @@ class MovePage {
                                $status = Status::newFatal( 'movepage-max-pages', $wgMaximumMovedPages );
                                $perTitleStatus[$oldSubpage->getPrefixedText()] = $status;
                                $topStatus->merge( $status );
-                               $topStatus->setOk( true );
+                               $topStatus->setOK( true );
                                break;
                        }
 
@@ -477,7 +479,7 @@ class MovePage {
                        }
                        $perTitleStatus[$oldSubpage->getPrefixedText()] = $status;
                        $topStatus->merge( $status );
-                       $topStatus->setOk( true );
+                       $topStatus->setOK( true );
                }
 
                $topStatus->value = $perTitleStatus;
@@ -596,7 +598,7 @@ class MovePage {
                                '4::oldtitle' => $this->oldTitle->getPrefixedText(),
                        ] );
                        $logEntry->setRelations( [ 'pr_id' => $logRelationsValues ] );
-                       $logEntry->setTags( $changeTags );
+                       $logEntry->addTags( $changeTags );
                        $logId = $logEntry->insert();
                        $logEntry->publish( $logId );
                }
@@ -893,7 +895,7 @@ class MovePage {
                # Log the move
                $logid = $logEntry->insert();
 
-               $logEntry->setTags( $changeTags );
+               $logEntry->addTags( $changeTags );
                $logEntry->publish( $logid );
 
                return $nullRevision;