Commit ea7d4b09 authored by Petr Skoda's avatar Petr Skoda
Browse files

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

parent 668a499d
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment