X-Git-Url: http://git.cyclocoop.org//%22%22._DIR_PLUGIN_FULLCALENDAR.%22prive/themes/spip/images/event_edit.png/%22?a=blobdiff_plain;f=maintenance%2Frebuildrecentchanges.php;h=672bae86ce017f36d62c20fa7fd64fef6ef037c0;hb=0406ae156a7441c345a6239fdef936c1945251c3;hp=bbf91f585e5a737e47d892a04e1fca703188279b;hpb=2ef178072f6f46abde7bdcc2630389a8b2837557;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildrecentchanges.php b/maintenance/rebuildrecentchanges.php index bbf91f585e..672bae86ce 100644 --- a/maintenance/rebuildrecentchanges.php +++ b/maintenance/rebuildrecentchanges.php @@ -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__ ); @@ -495,5 +493,5 @@ class RebuildRecentchanges extends Maintenance { } } -$maintClass = "RebuildRecentchanges"; +$maintClass = RebuildRecentchanges::class; require_once RUN_MAINTENANCE_IF_MAIN;