MDL-32377 do not store incomplete component strings without local packs in on-disk string cache

This commit is contained in:
Petr Skoda
2012-04-16 23:55:35 +02:00
parent 668a499d89
commit ea7d4b0972
+9 -7
View File
@@ -6293,7 +6293,7 @@ class core_string_manager implements string_manager {
$component = $plugintype . '_' . $pluginname;
}
if (!$disablecache) {
if (!$disablecache and !$disablelocal) {
// try in-memory cache first
if (isset($this->cache[$lang][$component])) {
$this->countmemcache++;
@@ -6384,12 +6384,14 @@ class core_string_manager implements string_manager {
// we do not want any extra strings from other languages - everything must be in en lang pack
$string = array_intersect_key($string, $originalkeys);
// now we have a list of strings from all possible sources. put it into both in-memory and on-disk
// caches so we do not need to do all this merging and dependencies resolving again
$this->cache[$lang][$component] = $string;
if ($this->usediskcache) {
check_dir_exists("$this->cacheroot/$lang");
file_put_contents("$this->cacheroot/$lang/$component.php", "<?php \$this->cache['$lang']['$component'] = ".var_export($string, true).";");
if (!$disablelocal) {
// now we have a list of strings from all possible sources. put it into both in-memory and on-disk
// caches so we do not need to do all this merging and dependencies resolving again
$this->cache[$lang][$component] = $string;
if ($this->usediskcache) {
check_dir_exists("$this->cacheroot/$lang");
file_put_contents("$this->cacheroot/$lang/$component.php", "<?php \$this->cache['$lang']['$component'] = ".var_export($string, true).";");
}
}
return $string;
}