From f53828bf57380c08ca91607d8f1b2f0a18a6cabd Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 8 Mar 2017 15:34:41 -0800 Subject: [PATCH] Avoid wfMessage() call in Gadget cache updates This avoids purge problems due to layered caching. The message cache is known to take a while to regenerate and uses lockTSE=300. Bug: T157210 Change-Id: I418e160ddb61c4d3654780f5d2bbb14bc2827e2a --- includes/MediaWikiGadgetsDefinitionRepo.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/MediaWikiGadgetsDefinitionRepo.php b/includes/MediaWikiGadgetsDefinitionRepo.php index f600a7d4..06e0760f 100644 --- a/includes/MediaWikiGadgetsDefinitionRepo.php +++ b/includes/MediaWikiGadgetsDefinitionRepo.php @@ -108,12 +108,14 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo { */ public function fetchStructuredList( $forceNewText = null ) { if ( $forceNewText === null ) { - $g = wfMessage( "gadgets-definition" )->inContentLanguage(); - if ( !$g->exists() ) { + // T157210: avoid using wfMessage() to avoid staleness due to cache layering + $title = Title::makeTitle( NS_MEDIAWIKI, 'Gadgets-definition' ); + $rev = Revision::newFromTitle( $title ); + if ( !$rev || !$rev->getContent() || $rev->getContent()->isEmpty() ) { return false; // don't cache } - $g = $g->plain(); + $g = $rev->getContent()->getNativeData(); } else { $g = $forceNewText; }