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
This commit is contained in:
Aaron Schulz 2017-03-08 15:34:41 -08:00
parent c0b3041fad
commit f53828bf57

View file

@ -108,12 +108,14 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo {
*/ */
public function fetchStructuredList( $forceNewText = null ) { public function fetchStructuredList( $forceNewText = null ) {
if ( $forceNewText === null ) { if ( $forceNewText === null ) {
$g = wfMessage( "gadgets-definition" )->inContentLanguage(); // T157210: avoid using wfMessage() to avoid staleness due to cache layering
if ( !$g->exists() ) { $title = Title::makeTitle( NS_MEDIAWIKI, 'Gadgets-definition' );
$rev = Revision::newFromTitle( $title );
if ( !$rev || !$rev->getContent() || $rev->getContent()->isEmpty() ) {
return false; // don't cache return false; // don't cache
} }
$g = $g->plain(); $g = $rev->getContent()->getNativeData();
} else { } else {
$g = $forceNewText; $g = $forceNewText;
} }