( $this->hasOption( 'from' ) && !$this->hasOption( 'to' ) ) ||
( !$this->hasOption( 'from' ) && $this->hasOption( 'to' ) )
) {
- $this->error( "Both 'from' and 'to' must be given, or neither", 1 );
+ $this->fatalError( "Both 'from' and 'to' must be given, or neither" );
}
$this->rebuildRecentChangesTablePass1();
*/
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' ) );
$this->output( "Loading from page and revision tables...\n" );
- $commentQuery = $revCommentStore->getJoin();
+ $commentQuery = $commentStore->getJoin( 'rev_comment' );
$res = $dbw->select(
[ 'revision', 'page' ] + $commentQuery['tables'],
[
$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',
[
'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 ) {
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'],
[
$inserted = 0;
foreach ( $res as $row ) {
- $comment = $logCommentStore->getComment( $row );
+ $comment = $commentStore->getComment( 'log_comment', $row );
$dbw->insert(
'recentchanges',
[
'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__
);
}
}
-$maintClass = "RebuildRecentchanges";
+$maintClass = RebuildRecentchanges::class;
require_once RUN_MAINTENANCE_IF_MAIN;