Recycle bin deletes user data

Recycle bin deletes user data

by Przemek Kaszubski -
Number of replies: 6
Picture of Particularly helpful Moodlers Picture of Testers

Hi Everyone,

A question, observation or warning - based on a recent case on my Moodle 3.9.8.

1) Teacher devised an assignment, students submitted, teacher graded.

2) Teacher mistakenly deleted the assignment.

3) Teacher tried restoring from the Recycle bin, but all the submitted assignments and grades are gone sad(


I have carried out a similar test - using a discussion forum - to the same effect. Yes, I can restore the forum as such from the Recycle bin, but NOT the posts that were there.

In other words, all the user contents get irretrievably lost !


I also noticed that

  • the CLI script actually deletes user data such as grades from the database when an activity is deleted / sent to the Recycle bin
  • the restored activity has a DIFFERENT id number compared to the deleted original - it would appear that a COPY of the original activity is made when restoring from the bin - with its descriptions and settings , but any user input into these activities obviously cannot be copied..
I wonder if anyone can confirm this behaviour of the Recycle bin with Activities?

If this is how it works, Moodle should show SCREAMING warnings for teachers attempting to delete activities with user data.

It would really be best, however, if the very activities - with the original ID number* and with all the submissions, feedbackss, grades, posts, logs and what not - could be completely restored from the Recycle bin.


* PS. I did a deletion and restore of a forum also using a manager's roie, and this time the restored forum recovered the same ID number, but the post added to it earlier is gone...
Average of ratings: -
In reply to Przemek Kaszubski

Re: Recycle bin deletes user data

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
Sorry, my PS in the previous post:

"* PS. I did a deletion and restore of a forum also using a manager's roie, and this time the restored forum recovered the same ID number, but the post added to it earlier is gone..."

IS WRONG.
Also in the manager's case the restored forum's ID number was incremented - compared to the deleted original's ID.
In reply to Przemek Kaszubski

Re: Recycle bin deletes user data

by Ken Task -
Picture of Particularly helpful Moodlers

Question: Recyclebin uses the backup routine.  What are sites backup preferences defaults?

'SoS', Ken


In reply to Ken Task

Re: Recycle bin deletes user data

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
For the "General backup settings" and "Automated backup settings" I follow all the defaults. Thus these three are not included (everything else is checked on) :

backup_general_anonymize : OFF
backup_general_logs + backup_auto_log : OFF
backup_general_histories + backup_auto_histories : OFF

BTW: I never had problems restoring courses / activities with user data from automatic or default backups when user data was included. We do have

backup_general_users + backup_auto_users : ON

Thanks!

Przemek
In reply to Przemek Kaszubski

Re: Recycle bin deletes user data

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
I think I got it !

The setting
Include users restore | restore_general_users

on the /admin/settings.php?section=restoregeneralsettings

page must be ON (Moodle's default), and we had it turned OFF (we do quite a lot of course migrations between various Moodles, so I wanted to prevent users - my co-managers - from inadvertently restoring users into newly restored courses).

I'm glad Moodle is smarter than I had thought smile

However - I think - just like in the case of this discussion over the backup_auto_activities setting ,we need:

1) A suitable note in the documentation - https://docs.moodle.org/en/Recycle_bin .
cf. the current "Note: Automated backup settings in Site administration / Courses / Backups / Automated backup setup are also used for the recycle bin. In particular, 'Include activities and resources' (backup_auto_activities) must be enabled (box ticked) for the recycle bin to work. "

I can add / expand the note accordingly once I know my thinking is correct smile .

2) A warning on the "General restore defaults" settings page that this setting MUST be ON for Recycle Bin to work correctly  (perhaps also all the other defaults are needed for everything to work? Then the note could be added for the entire section "General restore settings", not "restore_general_users" only - I think this is likely).
(Cf. the message on "/admin/settings.php?section=automated" : "Note that these settings will be also be used for the recycle bin.")


Average of ratings:Useful (1)
In reply to Przemek Kaszubski

Re: Recycle bin deletes user data

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
PS. On a related matter:

It would appear that in the case of Forums it is NOT possible to bring back the Starred status of discussions - whether we use Recycle Bin or full manual default course / activity backup and then restore (into existing course) - including the logs and grade histories (i.e. with all the boxes ticked). Perhaps such data is not backed up, or is not / cannot be restored, or both.

Pinned status restores OK.
Average of ratings:Useful (1)
In reply to Przemek Kaszubski

Re: Recycle bin deletes user data

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
PS. For Activities to properly restore from the Recycle bin - together with any user data (submitted assignments, grades, forum posts etc.) - also this setting MUST be ON (ticked) :

Automated backup setup > Automated backup settings :
backup | backup_auto_users

Otherwise, the backup file of the deleted activity that is placed in the Recycle bin will NOT contain any user data..

I think this too should be added in the docs etc. - so I have now expanded the note on https://docs.moodle.org/311/en/Recycle_bin#Enabling_the_recycle_bin .
Average of ratings:Useful (1)