Restoring course into second site - user conflict error.

Restoring course into second site - user conflict error.

Gabriel Rigg發表於
Number of replies: 8

We are encountering a strange situation.  We have two sites with some overlapping users.  We have backed up course COURSE1 from SITE1, and are trying to restore into SITE2.  We are getting the "Trying to restore user XXXXX from backup will cause conflict" error.

  1. We have confirmed that the accounts are not site admin accounts.
  2. We have spot checked several users, to ensure their username and emails in SITE2 match the values in users.xml from the backup mbz.
  3. We have tried not restoring enrolment methods, and enrolling in to the manual enrolment instance in the new course
  4. We have tried restoring enrolment methods
  5. We have tried restoring without maintaining roles
Note that we are restoring as a NEW course, not merging into an existing course, or replacing an existing course.

Also note that these users probably do NOT share the exact same Moodle user ID value (the value from {user}.id in the database), but the documentation indicates that it will match on username and email alone.

Is there another reason these users would conflict?

評比平均分數: -
In reply to Gabriel Rigg

Re: Restoring course into second site - user conflict error.

Ken Task發表於
Particularly helpful Moodlers的相片

Site1 is what version of Moodle?

A role conflict could apply to roles other than admin level ... example: the backup has a user as Manager or Teacher and in Site2 that user has a role of student.   That would be an escalation of access and something not desired.

It's not just the admin users - any whose role in backup would escalate access level in new course/site.

So if the users already exist in Site2, the one thing you haven't tried is a no user backup of the course, restored, then assigning users and roles in the newly restored course.

'SoS', Ken


In reply to Ken Task

Re: Restoring course into second site - user conflict error.

Gabriel Rigg發表於
Hey Ken, thank you for responding. The course is being restored as a new course, so no users would have existing Teacher or Student roles in the course. Unfortunately, the course must also contain all of the existing user data. We have also checked the xml file within the mbz, and for the users listed, most do not have any role defined within the XML. If we could restore the users without any role, and manually assign the student role afterwards, that would be fine though!

We have tried the same course on the same site but using Moosh, and getting the same results.

The two sites are slightly different versions, and we are restoring a 3.11 backup into a 3.10 Moodle instance.

Is there any way we can tell the system to just ignore all roles for all users, and restore their enrolments without any role? We could write a script to assign the appropriate roles after the restore.
In reply to Gabriel Rigg

Re: Restoring course into second site - user conflict error.

Gabriel Rigg發表於
Nevermind, we did it programmatically! Thanks for your help.
In reply to Gabriel Rigg

Re: Restoring course into second site - user conflict error.

Ken Task發表於
Particularly helpful Moodlers的相片

Share back then .... others have run into same and your solution might prove to be something that gets included in cli core code! 微笑

'SoS', Ken


In reply to Gabriel Rigg

Re: Restoring course into second site - user conflict error.

Mary Cooch發表於
Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Testers的相片 Translators的相片
In reply to Mary Cooch

Re: Restoring course into second site - user conflict error.

Gabriel Rigg發表於
Thanks for answering Mary. Unfortunately, after trying everything in the documentation, including ensuring the usernames and emails match in the XML file to the {user}.username and {user}.email properties in the new site, and scrubbing any role information from the XML file (which was easy, since most of the conflict users didn't even have a role specified), we continue to get the same error.
In reply to Gabriel Rigg

Re: Restoring course into second site - user conflict error.

Gabriel Rigg發表於
Nevermind, we did it programmatically! Thanks for your help.
In reply to Gabriel Rigg

Re: Restoring course into second site - user conflict error.

Quintin Seegers發表於
Particularly helpful Moodlers的相片
Hi Gabriel,

We are having the exact same issue. In our case, we are migrating courses (with enrolled users) from Site1 (v3.11) to Site 2 (v3.10). The users don't exist in Site 2. We've found that restoring the first course, the new users are created in Site 2 without the 'conflict' error. However, when we try to restore subsequent courses (with the same enrolled users), we get this 'conflict' error for all the enrolled users that already exist in Site 2.

I'd be very interested in how exactly you solved it programmatically.

Thanks,
Quintin