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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.2, 2.7
    • Fix Version/s: 2.6.5, 2.7.2
    • Component/s: Libraries
    • Labels:
    • Sprint:
      BACKEND Sprint 14

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Sep/14