mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-22015 Committing Petr's improvement of core_string_manager disk cache
Version bump needed so that the cache is cleared on upgrade. Cached files are now valid PHP files instead of fetching them into string and running eval(). Credit goes to skodak.
This commit is contained in:
parent
c72fc30cde
commit
03c7d2dc89
@ -5946,9 +5946,9 @@ class core_string_manager implements string_manager {
|
||||
}
|
||||
|
||||
// try on-disk cache then
|
||||
if ($this->usediskcache and file_exists($this->cacheroot . "/$lang/$component")) {
|
||||
if ($this->usediskcache and file_exists($this->cacheroot . "/$lang/$component.php")) {
|
||||
$this->countdiskcache++;
|
||||
eval('$this->cache[$lang][$component] = ' . file_get_contents($this->cacheroot . "/$lang/$component") . ';');
|
||||
include($this->cacheroot . "/$lang/$component.php");
|
||||
return $this->cache[$lang][$component];
|
||||
}
|
||||
|
||||
@ -6029,7 +6029,7 @@ class core_string_manager implements string_manager {
|
||||
$this->cache[$lang][$component] = $string;
|
||||
if ($this->usediskcache) {
|
||||
check_dir_exists("$this->cacheroot/$lang", true, true);
|
||||
file_put_contents("$this->cacheroot/$lang/$component", var_export($string, true));
|
||||
file_put_contents("$this->cacheroot/$lang/$component.php", "<?php \$this->cache['$lang']['$component'] = ".var_export($string, true).";");
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2010052200; // YYYYMMDD = date of the last version bump
|
||||
$version = 2010052400; // YYYYMMDD = date of the last version bump
|
||||
// XX = daily increments
|
||||
|
||||
$release = '2.0 Preview 2 (Build: 20100524)'; // Human-friendly version name
|
||||
|
Loading…
x
Reference in New Issue
Block a user