Skip to content

Commit

Permalink
Fix logic in restore of backup file for 'numsections' - #73.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jul 21, 2020
1 parent bb44c6d commit 5077e1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Version Information
===================
Version 3.9.0.2 - 21/7/20
1. Fix logic in restore of backup file for 'numsections' - #73.

Version 3.9.0.1 - 19/7/20
1. Apply MDL-65539.
2. Apply MDL-68231.
Expand Down
15 changes: 7 additions & 8 deletions backup/moodle2/restore_format_topcoll_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,18 @@ protected function after_execute_structure() {
* This method is only executed if course configuration was overridden
*/
public function after_restore_course() {
$backupinfo = $this->step->get_task()->get_info();
if ($backupinfo->original_course_format !== 'topcoll') {
// Backup from another course format.
return;
}

global $DB;
if (!$this->need_restore_numsections()) {
/* Backup file was made in Moodle 3.3 or later and does not contain 'numsections',
so we don't need to process 'numsections' but we do need to set it! */
$courseid = $this->task->get_courseid();

global $DB;
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
print_error('invalidcourseid', 'error');
} // From /course/view.php.
Expand All @@ -158,13 +164,6 @@ public function after_restore_course() {
}

$data = $this->connectionpoint->get_data();
$backupinfo = $this->step->get_task()->get_info();
if ($backupinfo->original_course_format !== 'topcoll') {
// Backup from another course format.
return;
}

global $DB;
$numsections = (int)$data['tags']['numsections'];
foreach ($backupinfo->sections as $key => $section) {
/* For each section from the backup file check if it was restored and if was "orphaned" in the original
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
*/
defined('MOODLE_INTERNAL') || die();

$plugin->version = 2020071801;
$plugin->version = 2020071802;
$plugin->maturity = MATURITY_RC;
$plugin->requires = 2020061500.00; // 3.9 (Build: 20200615).
$plugin->component = 'format_topcoll';
$plugin->release = '3.9.0.1';
$plugin->release = '3.9.0.2';

0 comments on commit 5077e1d

Please sign in to comment.