Restoring Course with Deleted Users

Restoring Course with Deleted Users

by Tyler Bogdan -
Number of replies: 11

Hello!

I administer moodle for a school division's learning online program and I'm hoping to get some help.  I'd like to periodically delete the users in moodle that are not using it, either because they are no longer taking a course or because they have graduated.  My problem is that when you restore a course that includes students but the students are deleted you cannot see any of the information for the students in the restored course.  We need to keep these backups in case a student contests their grade and we must review their work.

What are my options here?  Is there a way to view course backups and their content without the original users still existing?

Average of ratings: -
In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Ken Task -
Picture of Particularly helpful Moodlers

If restoring a backup that contains users for the sake of check grades, etc., why not restore to a local host version .... on a laptop for such a purpose.   Or a true server within LAN/WAN that's not accessible from internet (uhhhh, we don't know the total situation).   Those stay off production server ... no user conflcts ... no having to find and remove users long since gone. ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: Restoring Course with Deleted Users

by Tyler Bogdan -

Hi Ken,

Thanks for the response but I'm not sure I understand.  I've run a test on our moodle server and if I take a back up of a course then delete the student out of moodle then restore the course the student is not recreated and none of that student's data is accessible.  Is this not typical behavior?  For instance a quiz would say "5 attempts" but when you click to review the attempts you can't see information per student because the students are deleted.

Are you suggesting I take a backup of the entire moodle database?

In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Ken Task -
Picture of Particularly helpful Moodlers

Your first post said ..

"My problem is that when you restore a course that includes students but the students are deleted you cannot see any of the information for the students in the restored course.  We need to keep these backups in case a student contests their grade and we must review their work."

Am basically suggesting why restore a course that has users long gone or that shouldn't be in or on the system any longer?

Why not use a 'sandbox' site ... same version as production ... and restore those courses there?

The students may have stayed on the system in other courses ... student assignments might still be in a hidden course ... as well as the students that were in that course.   So restoring a backup that had that student in the backup is also attempting to replace that students info with the account that's in the backup.   In the case of an Admin level user ... or manager level user ... Moodle might/should complain about the restore due to possible or direct conflicts with the roles of o those users.

To really see what's going on with Moodle, one cannot rely on the Moodle Admin UI.   Users .... just for grins, check out your mdl_user table.   See any accounts ... username is now the users email address with .########### at end (numbers are an epoch time stamp of when the users account was changed).   How may rows are in mdl_user compared to what you see when you go off into browsing users via the Moodle Admin UI?

'spirit of sharing', Ken

In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Ken Task -
Picture of Particularly helpful Moodlers

I"ve had the un-fortunate task (no pun intended) of trying to provide a Sheriff's department 'forensics' (ie, network and server access/records, etc.) for a student who murdered his parents.  That was upon request of the Technology Director of the ISD ... who actually made the request.

And haven't been involved in one of the following ... but there is potential for it in some communities/ISD's ...  especially for students that are in competition to graduate with highest honors.

Students and maybe Parents of student protest a grade ... and let's say for good measure they have legal representation + judge has granted technical reps hired by the lawyers a court order to the ISD allowing them to do their own investigation.

Could it really come to that?    Uhhhh .... yes.

I'd much rather have a sandbox server ... same version of Moodle as production, restore the course to that sandbox and then grant those technical reps full access to the sandbox.

My 2 cents.

'spirit of sharing', Ken

In reply to Ken Task

Re: Restoring Course with Deleted Users

by Tyler Bogdan -

Hi Ken,

I appreciate your take on the situation but I'm not sure a sandbox helps me...  Perhaps I'm not explaining myself well enough.  Consider this course of events:

  1. A student enrolls in our program, we create him a moodle account and he enrolls into an Accounting course from Jan 2017 to June 2017.
  2. At the end of June 2017 we take a full course backup of the course including the user data and retain it for our records.
  3. The student graduates at the end of June 2017
  4. At the end of June I would theoretically delete the student's user account from moodle, as a part of ongoing maintenance to maintain a clean user list.
  5. Six months go by and the student contests their final grade in a course.  We still have a backup so we restore it to examine it (into production or sandbox, it doesn't matter).  Because the user account no longer exists in moodle when we do the moodle restore the grades/activities/blog posts etc. don't line up with an existing user and so they don't show up in the course for examination. 

From your previous posts it seems that you are suggesting that during the restore the user accounts contained in a backup are re-instated automatically, this has not been my experience.  Emma's suggestion of restoring the user by updating the user database is perhaps a workable solution, as long as the users remain in the database indefinitely.

In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

The data is in the backup as long as you backed up with user data.

In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Ken Task -
Picture of Particularly helpful Moodlers

Is there a 'best practice' ... ever?   Don't think so ... too many factors.   I'll still contend that restoring a full backup of that course to a sandbox is a better way to  go - but that's me ... based upon my experiences ... as shared before + things am learning about a k12 site that was in dire need of cleanup after 2 years of 0 Moodle admin - or 'if it's working, don't fix it'. :\

Sure ... restoring a single user sounds best ... but what if the course ID has changed?   That does happen ... a course, for some reason, is going 'south' ... health check on the site points to this one course having issues with quizzes - which, if I'm not mistaken, is just part of the bigger question bank for the entire site.   Solution ... which really mask the problem ... backup course, restore course.

You've not mentioned how you handle end of course ... do you do resets? or are you using the older process of no user backup, restore no user backup to another course, hide original course?   If resets, course ID has not changed.   If no user restores to new course, course may have same full name/short name, etc. but course ID is different.

'spirit of sharing', Ken

In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

If you need the data kept for the students, don't delete them.  I think if you suspend them instead, you can still access their data.  If you need to see the data for deleted students, go into the database and change the deleted field from 1 to 0, effectively undeleting them.  Then reenroll them in the course and their grades should return.

In reply to Emma Richardson

Re: Restoring Course with Deleted Users

by Tyler Bogdan -

Hi Emma,

Un-deleting them by updating the database is a workable solution for me.  Can I reliably count on all the student information staying in the 'user' table after they are deleted?  Deleted users are never removed from this table?

In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

When I have had people delete students by mistake, this is what we have done to fix it and it has always worked.  I don't know if there is any time limit (for example if you automatically delete logs etc after so much time, I do not know if that would include student info but I don't believe so).

In reply to Tyler Bogdan

Re: Restoring Course with Deleted Users

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi Tyler,

For what i know, lines are never really deleted from mdl_user (just marked as "deleted"). But logs are regularly purged from oldest information.

What i do is that each year (you could do it twice a year), i make a complete backup of my whole Moodle (database, datadirectory and moodle files), that i archive somewhere in a secure way (for long time conservation). So, i'm always able to restore a whole Moodle, as it was some year ago if i need, and having all that existed at this time.

And generally, i restore it on a special (backup) Moodle server, with cron disabled, and in maintenance mode, so that it doesn't evolve anymore, and only administrators can access it, but are able to do it quickly, if in need to verify something from last year.

HTH,
Séverin

Average of ratings: Useful (1)