From fd3453d96cd01d58005cb1f96696eb1b5f983645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 23 Aug 2022 01:38:17 +0200 Subject: [PATCH] persistRevisionThreadItems: Allow processing current revisions only Bug: T315510 Change-Id: Iecde2a0a74a08b938ad0a089ed6d69662a8f28b1 --- maintenance/persistRevisionThreadItems.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/maintenance/persistRevisionThreadItems.php b/maintenance/persistRevisionThreadItems.php index 8ba96c25d..35eb6c916 100644 --- a/maintenance/persistRevisionThreadItems.php +++ b/maintenance/persistRevisionThreadItems.php @@ -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,