From 56e1d9badaa111ce91e5ae1aa651ac62e72802f9 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Thu, 28 Apr 2016 12:02:12 +0800 Subject: [PATCH] MDL-53716 competency: Do not restore competencies when disabled --- backup/moodle2/restore_stepslib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index b6733e424d1..861dcae7abb 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -3186,6 +3186,11 @@ class restore_course_competencies_structure_step extends restore_structure_step */ protected function execute_condition() { + // Do not restore when competencies are disabled. + if (!\core_competency\api::is_enabled()) { + return false; + } + // Do not execute if the competencies XML file is not found. $fullpath = $this->task->get_taskbasepath(); $fullpath = rtrim($fullpath, '/') . '/' . $this->filename; @@ -3256,6 +3261,11 @@ class restore_activity_competencies_structure_step extends restore_structure_ste */ protected function execute_condition() { + // Do not restore when competencies are disabled. + if (!\core_competency\api::is_enabled()) { + return false; + } + // Do not execute if the competencies XML file is not found. $fullpath = $this->task->get_taskbasepath(); $fullpath = rtrim($fullpath, '/') . '/' . $this->filename; -- 2.43.0