diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index 6e7a4610c40..d0036cf3fbc 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -2609,7 +2609,18 @@ class restore_course_logs_structure_step extends restore_structure_step { // If we have data, insert it, else something went wrong in the restore_logs_processor if ($data) { - $DB->insert_record('log', $data); + if (empty($data->url)) { + $data->url = ''; + } + if (empty($data->info)) { + $data->info = ''; + } + // Store the data in the legacy log table if we are still using it. + $manager = get_log_manager(); + if (method_exists($manager, 'legacy_add_to_log')) { + $manager->legacy_add_to_log($data->course, $data->module, $data->action, $data->url, + $data->info, $data->cmid, $data->userid); + } } } } @@ -2647,7 +2658,18 @@ class restore_activity_logs_structure_step extends restore_course_logs_structure // If we have data, insert it, else something went wrong in the restore_logs_processor if ($data) { - $DB->insert_record('log', $data); + if (empty($data->url)) { + $data->url = ''; + } + if (empty($data->info)) { + $data->info = ''; + } + // Store the data in the legacy log table if we are still using it. + $manager = get_log_manager(); + if (method_exists($manager, 'legacy_add_to_log')) { + $manager->legacy_add_to_log($data->course, $data->module, $data->action, $data->url, + $data->info, $data->cmid, $data->userid); + } } } } diff --git a/backup/util/helper/restore_logs_processor.class.php b/backup/util/helper/restore_logs_processor.class.php index 63ff8019fe3..585d9b432fd 100644 --- a/backup/util/helper/restore_logs_processor.class.php +++ b/backup/util/helper/restore_logs_processor.class.php @@ -89,11 +89,11 @@ class restore_logs_processor { } // Arrived here log is empty, no rule was able to perform the conversion, log the problem if (empty($newlog)) { - self::$task->log('Log module-action "' . $keyname . ' process problem. Not restored', backup::LOG_DEBUG); + self::$task->log('Log module-action "' . $keyname . '" process problem. Not restored', backup::LOG_DEBUG); } } else { // Action not found log the problem - self::$task->log('Log module-action "' . $keyname . ' unknown. Not restored', backup::LOG_DEBUG); + self::$task->log('Log module-action "' . $keyname . '" unknown. Not restored', backup::LOG_DEBUG); $newlog = false; }