From f1272bbecd703e9c6f7ae7eb0435cb89d440e2c3 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 9 Sep 2014 10:21:16 +0800 Subject: [PATCH] MDL-46696 backup: Handle older backups not containing grade history --- backup/moodle2/restore_stepslib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index e6251150c4c..1f8ec9e9447 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -3035,6 +3035,18 @@ class restore_activity_grades_structure_step extends restore_structure_step { */ class restore_activity_grade_history_structure_step extends restore_structure_step { + /** + * This step is executed only if the grade history file is present. + */ + protected function execute_condition() { + $fullpath = $this->task->get_taskbasepath(); + $fullpath = rtrim($fullpath, '/') . '/' . $this->filename; + if (!file_exists($fullpath)) { + return false; + } + return true; + } + protected function define_structure() { $paths = array();