dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Check requirements for parser test suite in phpunit tests"
[lhc/web/wiklou.git]
/
maintenance
/
rebuildrecentchanges.php
diff --git
a/maintenance/rebuildrecentchanges.php
b/maintenance/rebuildrecentchanges.php
index
142a4e5
..
a2cf3c5
100644
(file)
--- a/
maintenance/rebuildrecentchanges.php
+++ b/
maintenance/rebuildrecentchanges.php
@@
-32,9
+32,9
@@
use MediaWiki\MediaWikiServices;
* @ingroup Maintenance
*/
class RebuildRecentchanges extends Maintenance {
* @ingroup Maintenance
*/
class RebuildRecentchanges extends Maintenance {
- /** @var int
eger
UNIX timestamp */
+ /** @var int UNIX timestamp */
private $cutoffFrom;
private $cutoffFrom;
- /** @var int
eger
UNIX timestamp */
+ /** @var int UNIX timestamp */
private $cutoffTo;
public function __construct() {
private $cutoffTo;
public function __construct() {
@@
-80,6
+80,8
@@
class RebuildRecentchanges extends Maintenance {
*/
private function rebuildRecentChangesTablePass1() {
$dbw = $this->getDB( DB_MASTER );
*/
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' ) );
if ( $this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) {
$this->cutoffFrom = wfTimestamp( TS_UNIX, $this->getOption( 'from' ) );
@@
-113,13
+115,14
@@
class RebuildRecentchanges extends Maintenance {
}
$this->output( "Loading from page and revision tables...\n" );
}
$this->output( "Loading from page and revision tables...\n" );
+
+ $commentQuery = $revCommentStore->getJoin();
$res = $dbw->select(
$res = $dbw->select(
- [ '
page', 'revision'
],
+ [ '
revision', 'page' ] + $commentQuery['tables'
],
[
'rev_timestamp',
'rev_user',
'rev_user_text',
[
'rev_timestamp',
'rev_user',
'rev_user_text',
- 'rev_comment',
'rev_minor_edit',
'rev_id',
'rev_deleted',
'rev_minor_edit',
'rev_id',
'rev_deleted',
@@
-127,19
+130,22
@@
class RebuildRecentchanges extends Maintenance {
'page_title',
'page_is_new',
'page_id'
'page_title',
'page_is_new',
'page_id'
- ],
+ ]
+ $commentQuery['fields']
,
[
'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ),
[
'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__,
],
__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 ) {
);
$this->output( "Inserting from page and revision tables...\n" );
$inserted = 0;
foreach ( $res as $row ) {
+ $comment = $revCommentStore->getComment( $row );
$dbw->insert(
'recentchanges',
[
$dbw->insert(
'recentchanges',
[
@@
-148,7
+154,6
@@
class RebuildRecentchanges extends Maintenance {
'rc_user_text' => $row->rev_user_text,
'rc_namespace' => $row->page_namespace,
'rc_title' => $row->page_title,
'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_minor' => $row->rev_minor_edit,
'rc_bot' => 0,
'rc_new' => $row->page_is_new,
@@
-156,12
+161,9
@@
class RebuildRecentchanges extends Maintenance {
'rc_this_oldid' => $row->rev_id,
'rc_last_oldid' => 0, // is this ok?
'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
'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
- ? $dbw->addQuotes( RecentChange::SRC_NEW )
- : $dbw->addQuotes( RecentChange::SRC_EDIT )
- ,
+ 'rc_source' => $row->page_is_new ? RecentChange::SRC_NEW : RecentChange::SRC_EDIT,
'rc_deleted' => $row->rev_deleted
'rc_deleted' => $row->rev_deleted
- ],
+ ]
+ $rcCommentStore->insert( $dbw, $comment )
,
__METHOD__
);
if ( ( ++$inserted % $this->mBatchSize ) == 0 ) {
__METHOD__
);
if ( ( ++$inserted % $this->mBatchSize ) == 0 ) {
@@
-239,9
+241,7
@@
class RebuildRecentchanges extends Maintenance {
'rc_last_oldid' => $lastOldId,
'rc_new' => $new,
'rc_type' => $new ? RC_NEW : RC_EDIT,
'rc_last_oldid' => $lastOldId,
'rc_new' => $new,
'rc_type' => $new ? RC_NEW : RC_EDIT,
- 'rc_source' => $new === 1
- ? $dbw->addQuotes( RecentChange::SRC_NEW )
- : $dbw->addQuotes( RecentChange::SRC_EDIT ),
+ 'rc_source' => $new === 1 ? RecentChange::SRC_NEW : RecentChange::SRC_EDIT,
'rc_old_len' => $lastSize,
'rc_new_len' => $size,
],
'rc_old_len' => $lastSize,
'rc_new_len' => $size,
],
@@
-270,25
+270,27
@@
class RebuildRecentchanges extends Maintenance {
global $wgLogTypes, $wgLogRestrictions;
$dbw = $this->getDB( DB_MASTER );
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" );
$this->output( "Loading from user, page, and logging tables...\n" );
+ $commentQuery = $logCommentStore->getJoin();
$res = $dbw->select(
$res = $dbw->select(
- [ 'user', 'logging', 'page' ],
+ [ 'user', 'logging', 'page' ]
+ $commentQuery['tables']
,
[
'log_timestamp',
'log_user',
'user_name',
'log_namespace',
'log_title',
[
'log_timestamp',
'log_user',
'user_name',
'log_namespace',
'log_title',
- 'log_comment',
'page_id',
'log_type',
'log_action',
'log_id',
'log_params',
'log_deleted'
'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 ) ),
[
'log_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ),
'log_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ),
@@
-302,13
+304,14
@@
class RebuildRecentchanges extends Maintenance {
[
'page' =>
[ 'LEFT JOIN', [ 'log_namespace=page_namespace', 'log_title=page_title' ] ]
[
'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 ) {
);
$field = $dbw->fieldInfo( 'recentchanges', 'rc_cur_id' );
$inserted = 0;
foreach ( $res as $row ) {
+ $comment = $logCommentStore->getComment( $row );
$dbw->insert(
'recentchanges',
[
$dbw->insert(
'recentchanges',
[
@@
-317,7
+320,6
@@
class RebuildRecentchanges extends Maintenance {
'rc_user_text' => $row->user_name,
'rc_namespace' => $row->log_namespace,
'rc_title' => $row->log_title,
'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_minor' => 0,
'rc_bot' => 0,
'rc_patrolled' => 1,
@@
-325,7
+327,7
@@
class RebuildRecentchanges extends Maintenance {
'rc_this_oldid' => 0,
'rc_last_oldid' => 0,
'rc_type' => RC_LOG,
'rc_this_oldid' => 0,
'rc_last_oldid' => 0,
'rc_type' => RC_LOG,
- 'rc_source' =>
$dbw->addQuotes( RecentChange::SRC_LOG )
,
+ 'rc_source' =>
RecentChange::SRC_LOG
,
'rc_cur_id' => $field->isNullable()
? $row->page_id
: (int)$row->page_id, // NULL => 0,
'rc_cur_id' => $field->isNullable()
? $row->page_id
: (int)$row->page_id, // NULL => 0,
@@
-334,7
+336,7
@@
class RebuildRecentchanges extends Maintenance {
'rc_logid' => $row->log_id,
'rc_params' => $row->log_params,
'rc_deleted' => $row->log_deleted
'rc_logid' => $row->log_id,
'rc_params' => $row->log_params,
'rc_deleted' => $row->log_deleted
- ],
+ ]
+ $rcCommentStore->insert( $dbw, $comment )
,
__METHOD__
);
__METHOD__
);