From: Aaron Schulz Date: Sat, 27 Oct 2018 23:41:33 +0000 (-0700) Subject: Avoid broken markup due to conversion table DB queries in Installer:parse() X-Git-Tag: 1.34.0-rc.0~3630^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=387071ecc21387f1e68aacf4d20144a6423df8b6;p=lhc%2Fweb%2Fwiklou.git Avoid broken markup due to conversion table DB queries in Installer:parse() Bug: T207979 Change-Id: I6a196a64865533a073fadc4a07f5627b67924921 --- diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 5dee0f696c..5ada42fb77 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -516,7 +516,7 @@ class MessageCache { foreach ( $res as $row ) { $name = $this->contLang->lcfirst( $row->page_title ); // Include entries/stubs for all keys in $mostused in adaptive mode - if ( $wgAdaptiveMessageCache || isset( $overridable[$name] ) ) { + if ( $wgAdaptiveMessageCache || $this->isMainCacheable( $name, $overridable ) ) { $cache[$row->page_title] = '!TOO BIG'; } // At least include revision ID so page changes are reflected in the hash @@ -538,7 +538,7 @@ class MessageCache { foreach ( $res as $row ) { $name = $this->contLang->lcfirst( $row->page_title ); // Include entries/stubs for all keys in $mostused in adaptive mode - if ( $wgAdaptiveMessageCache || isset( $overridable[$name] ) ) { + if ( $wgAdaptiveMessageCache || $this->isMainCacheable( $name, $overridable ) ) { $text = Revision::getRevisionText( $row ); if ( $text === false ) { // Failed to fetch data; possible ES errors? @@ -574,6 +574,17 @@ class MessageCache { return $cache; } + /** + * @param string $name Message name with lowercase first letter + * @param array $overridable Map of (key => unused) for software-defined messages + * @return bool + */ + private function isMainCacheable( $name, array $overridable ) { + // Include common conversion table pages. This also avoids problems with + // Installer::parse() bailing out due to disallowed DB queries (T207979). + return ( isset( $overridable[$name] ) || strpos( $name, 'conversiontable/' ) === 0 ); + } + /** * Updates cache as necessary when message page is changed * @@ -1042,7 +1053,8 @@ class MessageCache { ); } else { // Message page either does not exist or does not override a software message - if ( !isset( $this->overridable[$this->contLang->lcfirst( $title )] ) ) { + $name = $this->contLang->lcfirst( $title ); + if ( !$this->isMainCacheable( $name, $this->overridable ) ) { // Message page does not override any software-defined message. A custom // message might be defined to have content or settings specific to the wiki. // Load the message page, utilizing the individual message cache as needed.