MDL-32377 do not store incomplete component strings without local packs in on-disk string cache
This commit is contained in:
+9
-7
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user