persistRevisionThreadItems: Allow processing current revisions only

Bug: T315510
Change-Id: Iecde2a0a74a08b938ad0a089ed6d69662a8f28b1
This commit is contained in:
Bartosz Dziewoński 2022-08-23 01:38:17 +02:00
parent e309fba4c2
commit fd3453d96c

View file

@ -49,6 +49,7 @@ class PersistRevisionThreadItems extends TableCleanup {
$this->addOption( 'rev', 'Revision ID to process', false, true, false, true );
$this->addOption( 'page', 'Page title to process', false, true, false, true );
$this->addOption( 'all', 'Process the whole wiki', false, false, false, false );
$this->addOption( 'current', 'Process current revisions only', false, false, false, false );
}
public function execute() {
@ -79,6 +80,12 @@ class PersistRevisionThreadItems extends TableCleanup {
return;
}
if ( $this->getOption( 'current' ) ) {
// runTable() doesn't provide a way to do a JOIN. This is equivalent, but it might have
// different performance characteristics. It should be good enough for a maintenance script.
$conds[] = 'rev_id IN ( SELECT page_latest FROM page )';
}
$this->runTable( [
'table' => 'revision',
'conds' => $conds,