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

Usage of get_config() in lib/db/upgrade.php could be problematic

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.6.5, 2.7.2
    • 2.6.2, 2.7
    • Libraries
    • BACKEND Sprint 14

      I've just noticed we've got the main upgrade file calling get_config() a bit:

      git grep get_config lib/db/upgrade.php
      lib/db/upgrade.php:            if ($filters = get_config(null, $config)) {
      lib/db/upgrade.php:            if (get_config('core', 'theme') === 'mymobile') {
      lib/db/upgrade.php:            if (get_config('core', 'thememobile') === 'mymobile') {
      lib/db/upgrade.php:            if (get_config('core', 'themelegacy') === 'mymobile') {
      lib/db/upgrade.php:            if (get_config('core', 'themetablet') === 'mymobile') {
      lib/db/upgrade.php:            if (in_array(get_config('core', 'theme'), $themes)) {
      lib/db/upgrade.php:            if (in_array(get_config('core', 'thememobile'), $themes)) {
      lib/db/upgrade.php:            if (in_array(get_config('core', 'themelegacy'), $themes)) {
      lib/db/upgrade.php:            if (in_array(get_config('core', 'themetablet'), $themes)) {
      

      That goes against our upgrade code restrictions:
      http://docs.moodle.org/dev/Upgrade_API#Upgrade_code_restrictions

      And more to the point, I don't think that function can be guaranteed to be long-term safe for upgrade. In fact it looks like it already uses a MUC cache - which itself could be problematic too.

      I think we should confert those uses to standard DB api calls.

            johno John Okely
            poltawski Dan Poltawski
            Dan Poltawski Dan Poltawski
            Sam Hemelryk Sam Hemelryk
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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