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

    XMLWordPrintable

Details

    • MOODLE_35_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-66221-401
    • MDL-66221-master
    • Hide

      This test is also covered with PHP unit 

      TEST 1 - With backup_auto_activities disabled
      As admin:
      1- Go to Site administration > Courses > Backups > Automated backup setup.
      2- Disable "Include activities and resources" (backup | backup_auto_activities)
      3- Go to Site administration > Plugins > Admin tools > Recycle bin.
      4- Enable "Auto hide" (tool_recyclebin | autohide)
      5- Create a new course (Course 1)
      6- Create one activity of type "forum" (Activity 1) in Course 1 
      7- Delete Activity 1
      8- Run the site cronjob manually

       php admin/cli/cron.php    

      9- Check no error is display in the terminal
      10- Go to Course 1 again
      11- Refresh your page and access the More menu dropdown
      12- Check the Recycle bin link is not visible
      13- Go to Course 1 and check that Activity 1 was removed. 

      TEST 2 - With backup_auto_activities enabled
      As admin:
      1- Go to Site administration > Courses > Backups > Automated backup setup.
      2- Enable "Include activities and resources" (backup | backup_auto_activities)
      3- Follow steps 6, 7, 8, 9, 10 from test 1
      4- Check the Activity 1 is in the bin
      5- Restore Activity 1
      6- Check no errors are display
      7- Go to Course 1 and check that Activity 1 is in the course

      Show
      This test is also covered with PHP unit  TEST 1 - With backup_auto_activities disabled As admin: 1- Go to Site administration > Courses > Backups > Automated backup setup. 2- Disable "Include activities and resources" (backup | backup_auto_activities) 3- Go to Site administration > Plugins > Admin tools > Recycle bin. 4- Enable "Auto hide" (tool_recyclebin | autohide) 5- Create a new course (Course 1) 6- Create one activity of type "forum" (Activity 1) in Course 1  7- Delete Activity 1 8- Run the site cronjob manually php admin/cli/cron.php   9- Check no error is display in the terminal 10- Go to Course 1 again 11- Refresh your page and access the More menu dropdown 12- Check the Recycle bin link is not visible 13- Go to Course 1 and check that Activity 1 was removed.  TEST 2 - With backup_auto_activities enabled As admin: 1- Go to Site administration > Courses > Backups > Automated backup setup. 2- Enable "Include activities and resources" (backup | backup_auto_activities) 3- Follow steps 6, 7, 8, 9, 10 from test 1 4- Check the Activity 1 is in the bin 5- Restore Activity 1 6- Check no errors are display 7- Go to Course 1 and check that Activity 1 is in the course
    • 10
    • Team Hedgehog Sprint 1.1, Team Hedgehog Sprint 1.2, Team Hedgehog Sprint 1.3, Team Hedgehog Sprint 1 review

    Description

      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

      Attachments

        1. 400_backup_disabled.gif
          400_backup_disabled.gif
          936 kB
        2. 400_backup_enabled.gif
          400_backup_enabled.gif
          564 kB
        3. 401_backup_disabled.gif
          401_backup_disabled.gif
          754 kB
        4. 401_backup_enabled.gif
          401_backup_enabled.gif
          792 kB
        5. activity-restore-errors.png
          activity-restore-errors.png
          40 kB
        6. automated_backup_settings.png
          automated_backup_settings.png
          154 kB
        7. Master_backup_disabled.gif
          Master_backup_disabled.gif
          919 kB
        8. Master_backup_enabled.gif
          Master_backup_enabled.gif
          940 kB
        9. Screenshot from 2021-02-03 08-11-49.png
          Screenshot from 2021-02-03 08-11-49.png
          10 kB
        10. success_unit_test.png
          success_unit_test.png
          61 kB
        11. test1_cron_success.png
          test1_cron_success.png
          35 kB
        12. test1_no_recycle_bin_and_acitivity.png
          test1_no_recycle_bin_and_acitivity.png
          52 kB
        13. test2_activity_in_bin.png
          test2_activity_in_bin.png
          43 kB
        14. test2_activity_restored.png
          test2_activity_restored.png
          22 kB
        15. test2_cron_success.png
          test2_cron_success.png
          35 kB
        16. test2_no_errors_on_restore.png
          test2_no_errors_on_restore.png
          35 kB

        Issue Links

          Activity

            People

              raquel.ortega@moodle.com Raquel Ortega
              lreynolds Logan Reynolds
              David Woloszyn David Woloszyn
              Jake Dallimore Jake Dallimore
              Ron Carl Alfon Yu Ron Carl Alfon Yu
              Votes:
              12 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days, 2 hours, 57 minutes
                  4d 2h 57m

                  Clockify

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