Merge "Set l18n cache to array in DevelopmentSettings.php"
[lhc/web/wiklou.git] / includes / api / ApiQueryRevisions.php
index ee6a264..5b2b1b7 100644 (file)
@@ -76,7 +76,8 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
         */
        public static function getRollbackToken( $pageid, $title, $rev ) {
                global $wgUser;
-               if ( !$wgUser->isAllowed( 'rollback' ) ) {
+               if ( !MediaWikiServices::getInstance()->getPermissionManager()
+                               ->userHasRight( $wgUser, 'rollback' ) ) {
                        return false;
                }
 
@@ -84,8 +85,6 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
        }
 
        protected function run( ApiPageSet $resultPageSet = null ) {
-               global $wgActorTableSchemaMigrationStage;
-
                $params = $this->extractRequestParams( false );
                $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
 
@@ -136,9 +135,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                $idField = 'rev_id';
                $tsField = 'rev_timestamp';
                $pageField = 'rev_page';
-               if ( $params['user'] !== null &&
-                       ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_READ_NEW )
-               ) {
+               if ( $params['user'] !== null ) {
                        // We're going to want to use the page_actor_timestamp index (on revision_actor_temp)
                        // so use that table's denormalized fields.
                        $idField = 'revactor_rev';
@@ -201,11 +198,12 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
 
                if ( $resultPageSet === null && $this->fetchContent ) {
                        // For each page we will request, the user must have read rights for that page
-                       $user = $this->getUser();
                        $status = Status::newGood();
+                       $user = $this->getUser();
+
                        /** @var Title $title */
                        foreach ( $pageSet->getGoodTitles() as $title ) {
-                               if ( !$title->userCan( 'read', $user ) ) {
+                               if ( !$this->getPermissionManager()->userCan( 'read', $user, $title ) ) {
                                        $status->fatal( ApiMessage::create(
                                                [ 'apierror-cannotviewtitle', wfEscapeWikiText( $title->getPrefixedText() ) ],
                                                'accessdenied'
@@ -331,9 +329,11 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                        }
                        if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
                                // Paranoia: avoid brute force searches (T19342)
-                               if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
+                               if ( !$this->getPermissionManager()->userHasRight( $this->getUser(), 'deletedhistory' ) ) {
                                        $bitmask = RevisionRecord::DELETED_USER;
-                               } elseif ( !$this->getUser()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
+                               } elseif ( !$this->getPermissionManager()
+                                       ->userHasAnyRight( $this->getUser(), 'suppressrevision', 'viewsuppressed' )
+                               ) {
                                        $bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
                                } else {
                                        $bitmask = 0;