From: moodler Date: Thu, 3 Jul 2003 12:19:54 +0000 (+0000) Subject: Keep strings cached in memory during a single page to improve performance X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2b32bdddb990905870fb5a0917580f8ad37a75de;p=moodle.git Keep strings cached in memory during a single page to improve performance on slow filesystems or bad file caching. (experimental) --- diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 27d42cbec1..3103352cf0 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1043,7 +1043,15 @@ function get_string($identifier, $module="", $a=NULL) { function get_string_from_file($identifier, $langfile, $destination) { /// This function is only used from get_string(). - include ($langfile); + + static $strings; // Keep the strings cached in memory. + + if (empty($strings[$langfile])) { + include ($langfile); + $strings[$langfile] = $string; + } else { + $string = &$strings[$langfile]; + } if (!isset ($string[$identifier])) { return false;