*/
private function rebuildRecentChangesTablePass1() {
$dbw = $this->getDB( DB_MASTER );
+ $revCommentStore = new CommentStore( 'rev_comment' );
+ $rcCommentStore = new CommentStore( 'rc_comment' );
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();
$res = $dbw->select(
- [ 'page', 'revision' ],
+ [ 'revision', 'page' ] + $commentQuery['tables'],
[
'rev_timestamp',
'rev_user',
'rev_user_text',
- 'rev_comment',
'rev_minor_edit',
'rev_id',
'rev_deleted',
'page_title',
'page_is_new',
'page_id'
- ],
+ ] + $commentQuery['fields'],
[
'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ),
- 'rev_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ),
- 'rev_page=page_id'
+ 'rev_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) )
],
__METHOD__,
- [ 'ORDER BY' => 'rev_timestamp DESC' ]
+ [ 'ORDER BY' => 'rev_timestamp DESC' ],
+ [
+ 'page' => [ 'JOIN', 'rev_page=page_id' ],
+ ] + $commentQuery['joins']
);
$this->output( "Inserting from page and revision tables...\n" );
$inserted = 0;
foreach ( $res as $row ) {
+ $comment = $revCommentStore->getComment( $row );
$dbw->insert(
'recentchanges',
[
'rc_user_text' => $row->rev_user_text,
'rc_namespace' => $row->page_namespace,
'rc_title' => $row->page_title,
- 'rc_comment' => $row->rev_comment,
'rc_minor' => $row->rev_minor_edit,
'rc_bot' => 0,
'rc_new' => $row->page_is_new,
'rc_this_oldid' => $row->rev_id,
'rc_last_oldid' => 0, // is this ok?
'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
- 'rc_source' => $row->page_is_new ? RecentChange::SRC_NEW : RecentChange::SRC_EDIT
- ,
+ 'rc_source' => $row->page_is_new ? RecentChange::SRC_NEW : RecentChange::SRC_EDIT,
'rc_deleted' => $row->rev_deleted
- ],
+ ] + $rcCommentStore->insert( $dbw, $comment ),
__METHOD__
);
if ( ( ++$inserted % $this->mBatchSize ) == 0 ) {
global $wgLogTypes, $wgLogRestrictions;
$dbw = $this->getDB( DB_MASTER );
+ $logCommentStore = new CommentStore( 'log_comment' );
+ $rcCommentStore = new CommentStore( 'rc_comment' );
$this->output( "Loading from user, page, and logging tables...\n" );
+ $commentQuery = $logCommentStore->getJoin();
$res = $dbw->select(
- [ 'user', 'logging', 'page' ],
+ [ 'user', 'logging', 'page' ] + $commentQuery['tables'],
[
'log_timestamp',
'log_user',
'user_name',
'log_namespace',
'log_title',
- 'log_comment',
'page_id',
'log_type',
'log_action',
'log_id',
'log_params',
'log_deleted'
- ],
+ ] + $commentQuery['fields'],
[
'log_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ),
'log_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ),
[
'page' =>
[ 'LEFT JOIN', [ 'log_namespace=page_namespace', 'log_title=page_title' ] ]
- ]
+ ] + $commentQuery['joins']
);
$field = $dbw->fieldInfo( 'recentchanges', 'rc_cur_id' );
$inserted = 0;
foreach ( $res as $row ) {
+ $comment = $logCommentStore->getComment( $row );
$dbw->insert(
'recentchanges',
[
'rc_user_text' => $row->user_name,
'rc_namespace' => $row->log_namespace,
'rc_title' => $row->log_title,
- 'rc_comment' => $row->log_comment,
'rc_minor' => 0,
'rc_bot' => 0,
'rc_patrolled' => 1,
'rc_logid' => $row->log_id,
'rc_params' => $row->log_params,
'rc_deleted' => $row->log_deleted
- ],
+ ] + $rcCommentStore->insert( $dbw, $comment ),
__METHOD__
);