Merge "FauxRequest: don’t override getValues()"
[lhc/web/wiklou.git] / includes / export / WikiExporter.php
index 3ab88e2..fd200d1 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 use MediaWiki\MediaWikiServices as MediaWikiServicesAlias;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
@@ -304,29 +304,36 @@ class WikiExporter {
                if ( $cond ) {
                        $where[] = $cond;
                }
-               # Get logging table name for logging.* clause
-               $logging = $this->db->tableName( 'logging' );
-
                $result = null; // Assuring $result is not undefined, if exception occurs early
 
                $commentQuery = CommentStore::getStore()->getJoin( 'log_comment' );
                $actorQuery = ActorMigration::newMigration()->getJoin( 'log_user' );
 
+               $tables = array_merge(
+                       [ 'logging' ], $commentQuery['tables'], $actorQuery['tables'], [ 'user' ]
+               );
+               $fields = [
+                       'log_id', 'log_type', 'log_action', 'log_timestamp', 'log_namespace',
+                       'log_title', 'log_params', 'log_deleted', 'user_name'
+               ] + $commentQuery['fields'] + $actorQuery['fields'];
+               $options = [
+                       'ORDER BY' => 'log_id',
+                       'USE INDEX' => [ 'logging' => 'PRIMARY' ],
+                       'LIMIT' => self::BATCH_SIZE,
+               ];
+               $joins = [
+                       'user' => [ 'JOIN', 'user_id = ' . $actorQuery['fields']['log_user'] ]
+               ] + $commentQuery['joins'] + $actorQuery['joins'];
+
                $lastLogId = 0;
                while ( true ) {
                        $result = $this->db->select(
-                               array_merge( [ 'logging' ], $commentQuery['tables'], $actorQuery['tables'], [ 'user' ] ),
-                               [ "{$logging}.*", 'user_name' ] + $commentQuery['fields'] + $actorQuery['fields'],
+                               $tables,
+                               $fields,
                                array_merge( $where, [ 'log_id > ' . intval( $lastLogId ) ] ),
                                __METHOD__,
-                               [
-                                       'ORDER BY' => 'log_id',
-                                       'USE INDEX' => [ 'logging' => 'PRIMARY' ],
-                                       'LIMIT' => self::BATCH_SIZE,
-                               ],
-                               [
-                                       'user' => [ 'JOIN', 'user_id = ' . $actorQuery['fields']['log_user'] ]
-                               ] + $commentQuery['joins'] + $actorQuery['joins']
+                               $options,
+                               $joins
                        );
 
                        if ( !$result->numRows() ) {