Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.7.1, 1.7.2, 1.8
-
None
-
MOODLE_17_STABLE, MOODLE_18_STABLE
-
MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
Description
The admin/settings/location.php has:
$temp = new admin_settingpage('locationsettings', get_string('locationsettings', 'admin'));
$options = get_list_of_timezones();
$options[99] = get_string('serverlocaltime');
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
$options = get_list_of_timezones();
$options[99] = get_string('timezonenotforced', 'admin');
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
Here the $options is loaded again with the exact same items in the second call of get_list_of_timezones(). Suggestion: just remove the second instance of "$options = get_list_of_timezones();", the $options already contains what we need.
The get_list_of_timezones() is quite slow as it, for example, calls get_text() 377 times with the current list of timezones, so it should be avoided here.