Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-8451

admin/settings/location.php unnecessarily calls get_list_of_timezones() twice

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7.1, 1.7.2, 1.8
    • 1.7.3, 1.8.3, 1.9
    • Administration
    • 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.

      Attachments

        Activity

          People

            dougiamas Martin Dougiamas
            samulik Samuli Karevaara
            Nobody Nobody
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/Oct/07