Merge "Fix ParserOutput::getText 'unwrap' flag for end-of-doc comment"
[lhc/web/wiklou.git] / maintenance / rebuildrecentchanges.php
index f26d8b3..672bae8 100644 (file)
@@ -80,8 +80,7 @@ class RebuildRecentchanges extends Maintenance {
         */
        private function rebuildRecentChangesTablePass1() {
                $dbw = $this->getDB( DB_MASTER );
-               $revCommentStore = new CommentStore( 'rev_comment' );
-               $rcCommentStore = new CommentStore( 'rc_comment' );
+               $commentStore = CommentStore::getStore();
 
                if ( $this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) {
                        $this->cutoffFrom = wfTimestamp( TS_UNIX, $this->getOption( 'from' ) );
@@ -116,7 +115,7 @@ class RebuildRecentchanges extends Maintenance {
 
                $this->output( "Loading from page and revision tables...\n" );
 
-               $commentQuery = $revCommentStore->getJoin();
+               $commentQuery = $commentStore->getJoin( 'rev_comment' );
                $res = $dbw->select(
                        [ 'revision', 'page' ] + $commentQuery['tables'],
                        [
@@ -145,7 +144,7 @@ class RebuildRecentchanges extends Maintenance {
                $this->output( "Inserting from page and revision tables...\n" );
                $inserted = 0;
                foreach ( $res as $row ) {
-                       $comment = $revCommentStore->getComment( $row );
+                       $comment = $commentStore->getComment( 'rev_comment', $row );
                        $dbw->insert(
                                'recentchanges',
                                [
@@ -163,7 +162,7 @@ class RebuildRecentchanges extends Maintenance {
                                        'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
                                        'rc_source' => $row->page_is_new ? RecentChange::SRC_NEW : RecentChange::SRC_EDIT,
                                        'rc_deleted' => $row->rev_deleted
-                               ] + $rcCommentStore->insert( $dbw, $comment ),
+                               ] + $commentStore->insert( $dbw, 'rc_comment', $comment ),
                                __METHOD__
                        );
                        if ( ( ++$inserted % $this->getBatchSize() ) == 0 ) {
@@ -270,12 +269,11 @@ class RebuildRecentchanges extends Maintenance {
                global $wgLogTypes, $wgLogRestrictions;
 
                $dbw = $this->getDB( DB_MASTER );
-               $logCommentStore = new CommentStore( 'log_comment' );
-               $rcCommentStore = new CommentStore( 'rc_comment' );
+               $commentStore = CommentStore::getStore();
 
                $this->output( "Loading from user, page, and logging tables...\n" );
 
-               $commentQuery = $logCommentStore->getJoin();
+               $commentQuery = $commentStore->getJoin( 'log_comment' );
                $res = $dbw->select(
                        [ 'user', 'logging', 'page' ] + $commentQuery['tables'],
                        [
@@ -311,7 +309,7 @@ class RebuildRecentchanges extends Maintenance {
 
                $inserted = 0;
                foreach ( $res as $row ) {
-                       $comment = $logCommentStore->getComment( $row );
+                       $comment = $commentStore->getComment( 'log_comment', $row );
                        $dbw->insert(
                                'recentchanges',
                                [
@@ -336,7 +334,7 @@ class RebuildRecentchanges extends Maintenance {
                                        'rc_logid' => $row->log_id,
                                        'rc_params' => $row->log_params,
                                        'rc_deleted' => $row->log_deleted
-                               ] + $rcCommentStore->insert( $dbw, $comment ),
+                               ] + $commentStore->insert( $dbw, 'rc_comment', $comment ),
                                __METHOD__
                        );