mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-25019 backup - course_startdate may not exist
This commit is contained in:
parent
f2956c9813
commit
636444e8b6
3 changed files with 17 additions and 3 deletions
|
@ -88,6 +88,13 @@ abstract class base_step implements executable, loggable {
|
|||
return $this->task->get_setting($name);
|
||||
}
|
||||
|
||||
protected function setting_exists($name) {
|
||||
if (is_null($this->task)) {
|
||||
throw new base_step_exception('not_specified_base_task');
|
||||
}
|
||||
return $this->task->setting_exists($name);
|
||||
}
|
||||
|
||||
protected function get_setting_value($name) {
|
||||
if (is_null($this->task)) {
|
||||
throw new base_step_exception('not_specified_base_task');
|
||||
|
|
|
@ -87,6 +87,10 @@ abstract class base_task implements checksumable, executable, loggable {
|
|||
}
|
||||
}
|
||||
|
||||
public function setting_exists($name) {
|
||||
return $this->plan->setting_exists($name);
|
||||
}
|
||||
|
||||
public function get_setting_value($name) {
|
||||
return $this->get_setting($name)->get_value();
|
||||
}
|
||||
|
|
|
@ -213,10 +213,13 @@ abstract class restore_structure_step extends restore_step {
|
|||
}
|
||||
// No cache, let's calculate the offset
|
||||
$original = $this->task->get_info()->original_course_startdate;
|
||||
$setting = 0;
|
||||
if ($this->setting_exists('course_startdate')) { // Seting may not exist (MDL-25019)
|
||||
$setting = $this->get_setting_value('course_startdate');
|
||||
}
|
||||
|
||||
// Original course has not startdate, offset = 0
|
||||
if (empty($original)) {
|
||||
// Original course has not startdate or setting doesn't exist, offset = 0
|
||||
if (empty($original) || empty($setting)) {
|
||||
$cache[$this->get_restoreid()] = 0;
|
||||
|
||||
// Less than 24h of difference, offset = 0 (this avoids some problems with timezones)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue