-
Bug
-
Resolution: Fixed
-
Critical
-
2.4
-
MOODLE_24_STABLE
-
MOODLE_24_STABLE
-
MDL-34872-master -
When running the CLI to create backups, an exception was raised 'invaliduser'.
After digging a bit, I think this is a regression caused by MDL-33061.
This seem to fix the issue:
diff --git a/backup/moodle2/backup_stepslib.php b/backup/moodle2/backup_stepslib.php
|
index 24d7da9..78c0a45 100644
|
--- a/backup/moodle2/backup_stepslib.php
|
+++ b/backup/moodle2/backup_stepslib.php
|
@@ -1835,7 +1835,7 @@ class backup_annotate_all_user_files extends backup_execution_step {
|
'backupid' => $this->get_backupid(), 'itemname' => 'userfinal'));
|
foreach ($rs as $record) {
|
$userid = $record->itemid;
|
- $userctx = context_user::instance($userid);
|
+ $userctx = context_user::instance($userid, IGNORE_MISSING);
|
if (!$userctx) {
|
continue; // User has not context, sure it's a deleted user, so cannot have files
|
}
|
I did not test those replication steps, but they should work:
- Create a course and enrol users in them
- Delete one of those users
- Run `php admin/cli/automated_backups.php`
Expected:
- The course is backed up
Actual:
- An exception is raised, the course and the following are not backed up
- is a regression caused by
-
MDL-33061 META : Remove deprecated api function get_context_instance() and replace calls with context_XXX::instance()
-
- Closed
-