]> git.mjollnir.org Git - moodle.git/commitdiff
Add some caching to get_list_of_timezones
authormoodler <moodler>
Wed, 11 Jul 2007 09:11:44 +0000 (09:11 +0000)
committermoodler <moodler>
Wed, 11 Jul 2007 09:11:44 +0000 (09:11 +0000)
lib/moodlelib.php

index 19cd7e9e798993ba7a54ca8b4562ef242629be8e..cf3c280850098ba3d499e47e9c0bc97e57f0e4ae 100644 (file)
@@ -4885,6 +4885,12 @@ function get_list_of_pixnames($lang = '') {
 function get_list_of_timezones() {
     global $CFG;
 
+    static $timezones;
+
+    if (!empty($timezones)) {    // This function has been called recently
+        return $timezones;
+    }
+
     $timezones = array();
 
     if ($rawtimezones = get_records_sql('SELECT MAX(id), name FROM '.$CFG->prefix.'timezone GROUP BY name')) {