Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374583 )

Change subject: Actually cache fallback language templates
......................................................................

Actually cache fallback language templates

In the previous code, if there was an en-br attempt followed by an
en-za attempt, the 'en' template would not be cached under en-za.
Cache after the en-br mail:
[ 'en' => 'en template', 'en-br' => 'en template' ]
Then on the en-za attempt, it attempts to load en-za and fails, falls
back to en, and immediately returns the cached en template without
caching it under en-za.

Bug: T170435
Change-Id: I68996e2ba849e31a71df59c5782fac22f69d95b4
---
M sites/all/modules/wmf_communication/Templating.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/83/374583/1

diff --git a/sites/all/modules/wmf_communication/Templating.php 
b/sites/all/modules/wmf_communication/Templating.php
index b61052e..6f6bde7 100644
--- a/sites/all/modules/wmf_communication/Templating.php
+++ b/sites/all/modules/wmf_communication/Templating.php
@@ -123,9 +123,10 @@
         do {
             $cacheKey = $this->getFilePath( $language );
             if ( array_key_exists( $cacheKey, self::$template_cache ) ) {
-                return self::$template_cache[$cacheKey];
-            }
-            $template = $this->loadTemplateFile( $language );
+                $template = self::$template_cache[$cacheKey];
+            } else {
+                               $template = $this->loadTemplateFile( $language 
);
+                       }
             if ( $template ) {
                 self::$template_cache[$cacheKey] = $template;
                 if ( $language !== $this->language ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/374583
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68996e2ba849e31a71df59c5782fac22f69d95b4
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <ej...@ejegg.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to