Merge "benchmarks: Add benchmark for JavaScriptMinifier"
[lhc/web/wiklou.git] / includes / api / ApiQueryDeletedRevisions.php
index b7fd8d4..c3af71b 100644 (file)
@@ -23,6 +23,9 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\RevisionRecord;
+
 /**
  * Query module to enumerate deleted revisions for pages.
  *
@@ -55,12 +58,13 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
                $params = $this->extractRequestParams( false );
 
                $db = $this->getDB();
+               $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
 
                $this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
 
                if ( $resultPageSet === null ) {
                        $this->parseParameters( $params );
-                       $arQuery = Revision::getArchiveQueryInfo();
+                       $arQuery = $revisionStore->getArchiveQueryInfo();
                        $this->addTables( $arQuery['tables'] );
                        $this->addFields( $arQuery['fields'] );
                        $this->addJoinConds( $arQuery['joins'] );
@@ -88,16 +92,11 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
                }
 
                if ( $this->fetchContent ) {
-                       // Modern MediaWiki has the content for deleted revs in the 'text'
-                       // table using fields old_text and old_flags. But revisions deleted
-                       // pre-1.5 store the content in the 'archive' table directly using
-                       // fields ar_text and ar_flags, and no corresponding 'text' row. So
-                       // we have to LEFT JOIN and fetch all four fields.
                        $this->addTables( 'text' );
                        $this->addJoinConds(
                                [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ]
                        );
-                       $this->addFields( [ 'ar_text', 'ar_flags', 'old_text', 'old_flags' ] );
+                       $this->addFields( [ 'old_text', 'old_flags' ] );
 
                        // This also means stricter restrictions
                        $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] );
@@ -137,9 +136,9 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
                        // (shouldn't be able to get here without 'deletedhistory', but
                        // check it again just in case)
                        if ( !$user->isAllowed( 'deletedhistory' ) ) {
-                               $bitmask = Revision::DELETED_USER;
+                               $bitmask = RevisionRecord::DELETED_USER;
                        } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
-                               $bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
+                               $bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
                        } else {
                                $bitmask = 0;
                        }
@@ -239,7 +238,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
 
                                $fit = $this->addPageSubItem(
                                        $pageMap[$row->ar_namespace][$row->ar_title],
-                                       $this->extractRevisionInfo( Revision::newFromArchiveRow( $row ), $row ),
+                                       $this->extractRevisionInfo( $revisionStore->newRevisionFromArchiveRow( $row ), $row ),
                                        'rev'
                                );
                                if ( !$fit ) {