diff --git a/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php b/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php index 7901ef02f06..0c00f00880a 100644 --- a/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php +++ b/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php @@ -105,7 +105,8 @@ abstract class restore_tool_log_logstore_subplugin extends restore_subplugin { ($mapping['restore'] === \core\event\base::NOT_MAPPED)) { $data->objectid = \core\event\base::NOT_MAPPED; } else { - $data->objectid = $this->get_mappingid($mapping['restore'], $data->objectid); + $data->objectid = $this->get_mappingid($mapping['restore'], $data->objectid, + \core\event\base::NOT_FOUND); } } } else { @@ -131,7 +132,8 @@ abstract class restore_tool_log_logstore_subplugin extends restore_subplugin { ($mapping['restore'] === \core\event\base::NOT_MAPPED)) { $data->other[$key] = \core\event\base::NOT_MAPPED; } else { - $data->other[$key] = $this->get_mappingid($mapping['restore'], $value); + $data->other[$key] = $this->get_mappingid($mapping['restore'], $value, + \core\event\base::NOT_FOUND); } } } diff --git a/lib/classes/event/base.php b/lib/classes/event/base.php index 88685a4e115..17d399b6286 100644 --- a/lib/classes/event/base.php +++ b/lib/classes/event/base.php @@ -80,6 +80,11 @@ abstract class base implements \IteratorAggregate { */ const NOT_MAPPED = -31337; + /** + * The value used when an id can not be found during a restore. + */ + const NOT_FOUND = -31338; + /** @var array event data */ protected $data;