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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.1, 1.7.2, 1.8
    • Fix Version/s: 1.7.3, 1.8.3, 1.9
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE
    • Fixed Branches:
      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

            Assignee:
            dougiamas Martin Dougiamas
            Reporter:
            samulik Samuli Karevaara
            Tester:
            Nobody
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Oct/07