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

Deleted activities cannot be restored from recycle bin when backup_auto_activities setting is disabled



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.7
    • Fix Version/s: None
    • Component/s: Backup
    • Affected Branches:


      Our support team has discovered that when the backup_auto_activities setting is disabled in Automated backup settings, this has a side effect of preventing deleted items within a course from being restored from the recycle bin. Note this has nothing to do with actual course backup/restore, we're just talking about an activity that was deleted within a course having the following error when you attempt to restore it from the recycle bin, and then the activity is not restored and disappears even though the notification message indicates it was restored successfully per attached screenshot:

      Notice: Undefined index: contents in /var/www/html/MOODLE_35_STABLE/backup/util/helper/backup_general_helper.class.php on line 196
      Notice: Undefined index: in /var/www/html/MOODLE_35_STABLE/backup/moodle2/restore_plan_builder.class.php on line 136
      Notice: Trying to get property of non-object in /var/www/html/MOODLE_35_STABLE/backup/util/factories/restore_factory.class.php on line 37

      This seems like the affected portion of code should not be referencing the backup_auto_activities at all, and items should be able to be successfully restored from the recycle bin regardless of whether this setting is enabled. Steps to reproduce are:

      • On a Moodle 3.5.7 (or other) site disable the setting "Include activities and resources" ( backup_auto_activities ) under Site administration -> Courses -> Backups -> Automated backup setup
      • Go into a test course and create a test activity (we were using Forum but all activity types seem to be affected)
      • Delete the activity
      • Run the site cron
      • Revisit the site home page and access the Recycle bin under Course administration
      • Attempt to restore the deleted activity from the Recycle bin - you'll see the above notices and a message that the activity has been successfully restored
      • Return to the course homepage and see that the deleted activity has not been restored, but is also no longer in the Recycle bin


          Issue Links



              • Votes:
                2 Vote for this issue
                7 Start watching this issue


                • Created:

                  Time Tracking

                  Original Estimate - Not Specified
                  Not Specified
                  Remaining Estimate - 0 minutes
                  Time Spent - 10 minutes