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

Recycle bin is ignoring forced config settings

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE, MOODLE_404_STABLE
    • MOODLE_403_STABLE, MOODLE_404_STABLE
    • MDL-81119-forced-config-MOODLE_403_STABLE
    • MDL-81119-forced-config-MOODLE_404_STABLE
    • MDL-81119-forced-config
    • Hide

      Setup

      1. Go to Site administration > Courses > Backups > Automated backup setup.
      2. Disable "Include activities and resources" (backup | backup_auto_activities).
      3. In config.php, add this line to force the backup_auto_activities setting to
        $CFG->forced_plugin_settings['backup']['backup_auto_activities'] = '1';
      4. Reload the automated backup setup page and confirm that backup_auto_activities is Defined in config.php.
      5. Create a new test course.
      6. Create a new test activity - using label for complicity.
      7. Delete the test activity.

       

      Testing scenario 1: Course bin

      1. Wait for recycle bin to be updated via ad-hoc task (~1 min), or run the task or cronjob manually (php admin/cli/cron.php).
      2. Go to the test course again and refresh the page.
      3. From the 'More' menu drop down, click "Recycle bin".
      4. Verify that the deleted test activity appears in the recycle bin.
      5. Restore the test activity.
      6. Verify that the test activity has been restored and that no errors are displayed.

       

      Testing scenario 2: Category bin

      1. Go to Site administration > Courses > Manage courses and categories.
      2. Delete the test course created during the restore course steps.
      3. Go back to the Manage course categories and courses page.
      4. Click on the cog next to the course category of the deleted course, and click "Recycle bin".
      5. Verify that the deleted test course appears in the recycle bin.
      6. Restore the test course.
      7. Verify that the course was restored and that no errors are displayed.
      Show
      Setup Go to Site administration > Courses > Backups > Automated backup setup. Disable "Include activities and resources" (backup | backup_auto_activities). In config.php, add this line to force the backup_auto_activities setting to $CFG->forced_plugin_settings ['backup'] ['backup_auto_activities'] = '1'; Reload the automated backup setup page and confirm that backup_auto_activities is Defined in config.php. Create a new test course. Create a new test activity - using label for complicity. Delete the test activity.   Testing scenario 1: Course bin Wait for recycle bin to be updated via ad-hoc task (~1 min), or run the task or cronjob manually (php admin/cli/cron.php). Go to the test course again and refresh the page. From the 'More' menu drop down, click "Recycle bin". Verify that the deleted test activity appears in the recycle bin. Restore the test activity. Verify that the test activity has been restored and that no errors are displayed.   Testing scenario 2: Category bin Go to Site administration > Courses > Manage courses and categories. Delete the test course created during the restore course steps. Go back to the Manage course categories and courses page. Click on the cog next to the course category of the deleted course, and click "Recycle bin". Verify that the deleted test course appears in the recycle bin. Restore the test course. Verify that the course was restored and that no errors are displayed.

      I've found that when attempting to store items in the recycle bin, certain forced config settings are being ignored and fall back to using the value stored in the database. 

      This is causing an issue because MDL-66221 introduced a check on backup_auto_activities, and if that it not set activities will not be stored in the recycle bin when they are deleted. We've ran into a weird situation where the DB entry for backup_auto_activities ('0') didn't match doesn't match the forced config ('1'), and the DB value was being used which meant nothing was being stored in the recycle bin.

      After looking at the code it seems store_item and restore_item attempt to force two specific config values, but in doing so are overriding unrelated backup and restore forced config settings as well. 

      Reproduction steps:

      1. Go to Site administration > Courses > Backups > Automated backup setup.
      2. Disable "Include activities and resources" (backup | backup_auto_activities)
      3. In config.php, add this line to force the backup_auto_activities setting to 1:
        $CFG->forced_plugin_settings['backup']['backup_auto_activities'] = '1';
      4. Reload the automated backup setup page to confirm that backup_auto_activities is Defined in config.php
      5. Create a new test course
      6. Create a new test activity - using label for complicity
      7. Delete the test activity
      8. Wait for recycle bin to be updated via ad-hoc task (~1 min), or run the task or cronjob manually.
      9. Go to the test course again and refresh the page.
      10. The activity won't be in the recycle bin, and the recycle bin won't even appear if autohide is on. There aren't any error messages.

        1. MDL-81119.png
          MDL-81119.png
          213 kB
        2. MDL-81119 - 2.png
          MDL-81119 - 2.png
          444 kB
        3. MDL-81119 - 3.png
          MDL-81119 - 3.png
          585 kB

            benjaminwalker Benjamin Walker
            benjaminwalker Benjamin Walker
            Stevani Andolo Stevani Andolo
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 14 minutes
                5h 14m

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