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

Encourage the use of get_config/set_config instead of $CFG where ever possible

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE

      Description

      We've developed a plugin which allows non-administrators to change admin-level settings at the category level. https://moodle.org/plugins/view.php?id=677

      Currently one of the limitations which prevents a relatively clean implementation of this functionality is the use of $CFG in a number of plugins.

      Our method involves modifying get_config/set_config methods allowing them to check a 'category settings' table based off of the config/config_plugins tables.

      In order to make this work we've had to modify the core plugins anywhere $CFG-> is used and change to the get_config version.

      We'd like to get this started as a discussion as there may be issues with doing this we haven't discovered yet. For instance get_config does cause a lookup instead of a memory access which of course could mean performance degradation.
      We have already gone through and modified all the core modules and can provide the changes if this is accepted.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              tdjones Trevor Jones
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: