mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 09:43:30 +00:00
Allow maintenance script to only process pages touched in a time period
Bug: T334258 Change-Id: Iba5509c55d3eb0ab7b9500eebd8d68fe82bfda1d
This commit is contained in:
parent
0d21df43dc
commit
c0269e701c
|
@ -39,6 +39,8 @@ class PersistRevisionThreadItems extends Maintenance {
|
|||
$this->addOption( 'all', 'Process the whole wiki' );
|
||||
$this->addOption( 'current', 'Process current revisions only' );
|
||||
$this->addOption( 'start', 'Restart from this position (as printed by the script)', false, true );
|
||||
$this->addOption( 'touched-after', 'Only process pages touched after this timestamp', false, true );
|
||||
$this->addOption( 'touched-before', 'Only process pages touched before this timestamp', false, true );
|
||||
$this->setBatchSize( 100 );
|
||||
}
|
||||
|
||||
|
@ -97,6 +99,18 @@ class PersistRevisionThreadItems extends Maintenance {
|
|||
if ( $this->getOption( 'current' ) ) {
|
||||
$qb->where( 'rev_id = page_latest' );
|
||||
$index = [ 'page_id' ];
|
||||
|
||||
if ( $this->getOption( 'touched-after' ) ) {
|
||||
$qb->where( $this->dbr->buildComparison( '>', [
|
||||
'page_touched' => $this->dbr->timestamp( $this->getOption( 'touched-after' ) )
|
||||
] ) );
|
||||
}
|
||||
if ( $this->getOption( 'touched-before' ) ) {
|
||||
$qb->where( $this->dbr->buildComparison( '<', [
|
||||
'page_touched' => $this->dbr->timestamp( $this->getOption( 'touched-before' ) )
|
||||
] ) );
|
||||
}
|
||||
|
||||
} else {
|
||||
// Process in order by page and time to avoid confusing results while the script is running
|
||||
$index = [ 'rev_page', 'rev_timestamp', 'rev_id' ];
|
||||
|
|
Loading…
Reference in a new issue