From 8754e0775491e8513c47b86023cc5e40eb713ba7 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 31 Aug 2019 14:38:31 +0100 Subject: [PATCH] maintenance: Remove cross-wiki purging from rebuildmessages.php This script relied on numerous outdated or unofficial methods that are no longer supported. * Global variable $messageMemc holding a BagOStuff based on MessageCacheType. This logic is now in ServiceWiring for the MessageCache service. * String "{$db}:messages", should have been using BagOStuff::makeKey() and may've fallen out of sync. * Deleting keys outright instead of touching check keys as MessageCache does, since it's been using WANObjectCache for several years. All of this should be done via MessageCache::clear(), but that can't be easily constructed across wikis on a wiki farm. That requires instantiating the script for other wikis separately. Remove support for that, recommending instead that site admins run it in a loop for each wiki as needed. Realistically though, that should never be needed. The script has virtually no known use case, except (as documented in maintenance/README) "after changing a wiki's content language" - which applies to one wiki, not all a once. Change-Id: I9f45d65f5cef93d6e332baf26d955d3f7a7c19d2 --- maintenance/rebuildmessages.php | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/maintenance/rebuildmessages.php b/maintenance/rebuildmessages.php index 88eaf673f7..2f8dcc4a22 100644 --- a/maintenance/rebuildmessages.php +++ b/maintenance/rebuildmessages.php @@ -1,7 +1,5 @@ addDescription( 'Purge all language messages from the cache' ); + $this->addDescription( 'Purge the MessageCache for all interface languages.' ); } public function execute() { - global $wgLocalDatabases, $wgDBname, $wgEnableSidebarCache, $messageMemc; - if ( $wgLocalDatabases ) { - $databases = $wgLocalDatabases; - } else { - $databases = [ $wgDBname ]; - } - - foreach ( $databases as $db ) { - $this->output( "Deleting message cache for {$db}... " ); - $messageMemc->delete( "{$db}:messages" ); - if ( $wgEnableSidebarCache ) { - $messageMemc->delete( "{$db}:sidebar" ); - } - $this->output( "Deleted\n" ); - } + $this->output( "Purging message cache for all languages on this wiki... " ); + $messageCache = MediaWikiServices::getInstance()->getMessageCache(); + $messageCache->clear(); + $this->output( "Done\n" ); } } -- 2.20.1