API: Update query modules for MCR
[lhc/web/wiklou.git] / includes / api / ApiQueryContributors.php
index 48516a7..e39afac 100644 (file)
@@ -23,6 +23,9 @@
  * @since 1.23
  */
 
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\RevisionRecord;
+
 /**
  * A query module to show contributors to a page
  *
@@ -75,7 +78,7 @@ class ApiQueryContributors extends ApiQueryBase {
                }
 
                $result = $this->getResult();
-               $revQuery = Revision::getQueryInfo();
+               $revQuery = MediaWikiServices::getInstance()->getRevisionStore()->getQueryInfo();
 
                // For MIGRATION_NEW, target indexes on the revision_actor_temp table.
                // Otherwise, revision is fine because it'll have to check all revision rows anyway.
@@ -94,7 +97,7 @@ class ApiQueryContributors extends ApiQueryBase {
                ] );
                $this->addWhereFld( $pageField, $pages );
                $this->addWhere( ActorMigration::newMigration()->isAnon( $revQuery['fields']['rev_user'] ) );
-               $this->addWhere( $db->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0' );
+               $this->addWhere( $db->bitAnd( 'rev_deleted', RevisionRecord::DELETED_USER ) . ' = 0' );
                $this->addOption( 'GROUP BY', $pageField );
                $res = $this->select( __METHOD__ );
                foreach ( $res as $row ) {
@@ -106,7 +109,7 @@ class ApiQueryContributors extends ApiQueryBase {
                                // some other module used up all the space. Just set a dummy
                                // continue and hope it works next time.
                                $this->setContinueEnumParameter( 'continue',
-                                       $params['continue'] !== null ? $params['continue'] : '0|0'
+                                       $params['continue'] ?? '0|0'
                                );
 
                                return;
@@ -126,7 +129,7 @@ class ApiQueryContributors extends ApiQueryBase {
                ] );
                $this->addWhereFld( $pageField, $pages );
                $this->addWhere( ActorMigration::newMigration()->isNotAnon( $revQuery['fields']['rev_user'] ) );
-               $this->addWhere( $db->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0' );
+               $this->addWhere( $db->bitAnd( 'rev_deleted', RevisionRecord::DELETED_USER ) . ' = 0' );
                $this->addOption( 'GROUP BY', [ $pageField, $idField ] );
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
 
@@ -174,7 +177,7 @@ class ApiQueryContributors extends ApiQueryBase {
                        $this->addJoinConds( [ 'user_groups' => [
                                $excludeGroups ? 'LEFT OUTER JOIN' : 'INNER JOIN',
                                [
-                                       'ug_user=' . $actorQuery['fields']['rev_user'],
+                                       'ug_user=' . $revQuery['fields']['rev_user'],
                                        'ug_group' => $limitGroups,
                                        'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
                                ]