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

Saving forced config settings can insert incorrect DB values

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_404_STABLE

      When you click "Save" on a settings page with a forced config setting, certain setting types are treating the value as empty and are saving the corresponding value to the DB. I haven't managed to compile a full list because the handling of each type is different and not all are affected, but checkboxes are one of the main examples where the input will be considered "0" and saved regardless of the forced config setting and default.

      In most cases this won't cause any immediate issues since the forced config value will still take priority, but it can expose other issues like MDL-81119 and will likely cause confusion if the forced config is removed in the future. 

      From some quick testing I think this may have been caused by MDL-67650 marking the fields as disabled, but there could also be other related issues.

      Steps to reproduce:

      1. Go to Site administration > Courses > Backups > Automated backup setup.
      2. Make sure "Include activities and resources" (backup | backup_auto_activities) is enabled.
      3. In config.php, add this line to force the backup_auto_activities setting as enabled:
        $CFG->forced_plugin_settings['backup']['backup_auto_activities'] = '1';
      4. Reload the automated backup setup page and confirm that backup_auto_activities is enabled and listed as defined in config.php
      5. Click save.
      6. Remove the forced config that was added to config.php
      7. Reload the page and you will notice that the setting is now disabled.

      The changes will be listed in the config log. I've used backup_auto_activities as an example, but this includes many other settings and affects both config and plugin config.

            Unassigned Unassigned
            benjaminwalker Benjamin Walker
            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.