Ejegg has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/364790 )
Change subject: Cache result of language fallback lookups
......................................................................
Cache result of language fallback lookups
Change-Id: I386cf58509c9b76c28d0ba8fe13a935394fcea77
---
M sites/all/modules/thank_you/thank_you.module
M sites/all/modules/wmf_communication/Templating.php
2 files changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/90/364790/1
diff --git a/sites/all/modules/thank_you/thank_you.module
b/sites/all/modules/thank_you/thank_you.module
index 918401e..9ee8255 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -833,7 +833,7 @@
/**
*
*
- * @param $params template parameters
+ * @param $params array template parameters
*/
function thank_you_render( $params ) {
diff --git a/sites/all/modules/wmf_communication/Templating.php
b/sites/all/modules/wmf_communication/Templating.php
index f19bbb2..f2342e2 100644
--- a/sites/all/modules/wmf_communication/Templating.php
+++ b/sites/all/modules/wmf_communication/Templating.php
@@ -22,6 +22,8 @@
protected $format;
protected $template_params;
+ protected static $template_cache = array();
+
/**
* Prepare a template for substitution.
*
@@ -112,10 +114,14 @@
* @return \Twig_Template
*/
protected function loadTemplate() {
+ if ( array_key_exists( $this->language, self::$template_cache ) ) {
+ return self::$template_cache[$this->language];
+ }
$language = $this->language;
do {
$template = $this->loadTemplateFile( $language );
if ( $template ) {
+ self::$template_cache[$this->language] = $template;
return $template;
}
--
To view, visit https://gerrit.wikimedia.org/r/364790
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I386cf58509c9b76c28d0ba8fe13a935394fcea77
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits