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

Small refactor of upgraderunning checks

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.5.1
    • Installation
    • MOODLE_405_STABLE

      There is no point in setting:

      $upgraderunning = 0;

      In the code below:

      https://github.com/moodle/moodle/blob/269a8a8a1b3965e95e713ccc93ad1b7eb0d0e249/lib/upgradelib.php#L292
      if (!$upgraderunning) {
         if (CLI_SCRIPT) {
        // never stop CLI upgrades
        $upgraderunning = 0;
      } else {
        // web upgrade not running or aborted  throw new moodle_exception('upgradetimedout', 'admin', "$CFG>wwwroot/$CFG>admin/");
        }
      }
       

      As $upgraderunning is then not used for anything that setting it to 0 would influence.

      The code above would be equivalent to:

      if (!$upgraderunning && !CLI_SCRIPT)

      {             // web upgrade not running or aborted             throw new \moodle_exception('upgradetimedout', 'admin', "$CFG->wwwroot/$CFG->admin/"); }

       

      I also have some doubts about the logic here - when would the above condition (when $upgraderunning is false) trigger?

            Unassigned Unassigned
            tmuras Tomasz Muras
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.