How to restore course without the users from the backup being created

How to restore course without the users from the backup being created

על ידי Ulysses John Cun בתאריך
מספר תגובות: 6

Hello, Everyone

I have upgraded Moodle from 3.11.8 to 4.2.3 

Now I'm trying to restore the courses. At the GUI I am getting this error. 

Trying to restore user "john" from backup file will cause conflict

ממוצע דרוגים: -
בתגובה ל: Ulysses John Cun

How to restore course without the users from the backup being created

על ידי Ken Task בתאריך
תמונה של Particularly helpful Moodlers

Is user 'john' in the new server your own account?   And is it set to be an admin level?

Another way to avoid the conflict is to change login/email address of current user 'john' in new server.

Attempt to restore the course again - shouldn't find 'john' so no conflicts.   However, you did need to check the new 'john' account to see if it's Admin level and adjust appropriately.

If this one course has the issue, how many other course backups do you have that will probably have the same issue?

Think it's always been recommended NOT to assign an admin level user/account to a course as teacher for this very issue.

Am aslo curious as to why upgrading went to 4.2.3 when the highest/most secure of that version is 4.2.11
https://moodledev.io/general/releases/4.2

'SoS', Ken

בתגובה ל: Ken Task

How to restore course without the users from the backup being created

על ידי Ulysses John Cun בתאריך

Hello Ken, changing the login/email address worked. Thank you very much!

As for why I upgraded to 4.2.3 is. I upgraded from 3.11.2 to 3.11.8 then to 4.2.3 and planning to upgrade to version 5.

I have another question, is it possible to restore a course along with the enrolled users using the CLI tool (restore_backup.php). Because the restored courses via CLI tool did not include enrolled users. Since I am trying to automate it using the CLI tool because there are 300+ courses needed to be restored.

It works in the web UI by Restore to existing Course > Restore Settings and checking the "Include enrolled users" and selecting the "Yes, always" in the "Include enrolment methods" and enrolled users included after restoring.

בתגובה ל: Ulysses John Cun

How to restore course without the users from the backup being created

על ידי Ken Task בתאריך
תמונה של Particularly helpful Moodlers

Welcome!  Glad to hear it .. now some food for thought and suggestions ... my method of moodle madness!

Version of Moodle
https://moodledev.io/general/releases
4.2 is now 4.2.11 and no longer getting any fixes to code or security updates.

4.5 is a long term support version and is 4.5.6+ now - support until October 2027 - 2 years from now.

5.0 is a .0 and is now 5.0.2+ not a long term support version

In that series, 5.3 is the next LTS and it hasn't been released yet. What is in 5.0 that you just have to have?

I take it you are not using git for core versioning of moodle code, but, rather using the old method of upgrading which has too many moving parts, IMHO!

What's the end game here?  Getting same courses ready to take on new students?

If that's the case, could make a looping bash shell script to backup all 300+ courses that have users in them to a destination directory (outside of moodledata/filedir/)

Those are your record retention copies.

Then install moosh and use the moosh command to reuse courses ... remove all role ID 5 (students) from the existing courses leaving only the teachers and the content.
https://moosh-online.com/commands/#course-reset

Question about resetting ... are you the teacher in all of those 300+ courses?
Are you sure the teachers in those courses are done with them? Why not let teachers reset (called reuse in the menus of Moodle)?

'SoS', Ken

בתגובה ל: Ken Task

How to restore course without the users from the backup being created

על ידי Ulysses John Cun בתאריך
Thanks for the food for thought Ken, yes I'm not using git for the version control.

For context, deployed a new server with the bitnami package. Copied the moodle, moodledata folders, and mysql dump from the old server (which is running on moodle 3.11.2) and pasted them to the new server then proceeded to upgrade to 4.2.3. After upgrading to 4.2.3 the course were gone. I've restored the courses (using a backup from the old moodle server which has included users) using a script, however the enrolled users where not included after being restored.

I'm planning to upgrade it to 4.5 after the enrolled users of the courses are restored. So my endgame is to upgrade to 4.5 then to 5.0.2 without loosing the data.

About resetting, I am not the teacher for these courses. So currently I'm the only user in this server
בתגובה ל: Ulysses John Cun

How to restore course without the users from the backup being created

על ידי Ken Task בתאריך
תמונה של Particularly helpful Moodlers

Heads up ...
https://www.reddit.com/r/kubernetes/comments/1mc73s4/bitnami_moving_most_free_container_images_to_a/

Think git acquired code, even with a bitnami, can be done - and should be done ... IMHO!

Devils are in the details ...

So your first hop was from 3.11.2 to 4.2.3 in a non-standard method of migratiing and upgrading.
See
https://moodledev.io/general/releases/4.2
Server requirements
where is says:
"Moodle upgrade: Moodle 3.11.8 or later"

Those point release differences make a difference ... and how far the hop does for sure!

So remind us what issues are you having now ... course backups from old server restored to new server has no users?

What was auth/enrollment methods on old server?   If old server used manual then the backups that didn't have nu in their filename should have included users.   And, since manual, then no issues.   IF, however, the old server users authenticated via LDAP or Google or whatever, and that has not been setup on new server, then they might be there ... they just don't show! 

Do the backup files you are using have 'nu' in their filename?  That stands for 'no user'.

On old server:

mysql query of mdl_users for id,auth,firstname,lastname,email.

Same query on new server

Different?

'SoS', Ken