Merge branch 'MDL-69475_39' of https://github.com/stronk7/moodle into MOODLE_39_STABLE

This commit is contained in:
Adrian Greeve
2020-08-19 10:44:23 +08:00
4 changed files with 14 additions and 15 deletions
+8 -9
View File
@@ -122,7 +122,7 @@ class restore_gradebook_structure_step extends restore_structure_step {
}
// Identify the backup we're dealing with.
$backuprelease = floatval($this->get_task()->get_info()->backup_release); // The major version: 2.9, 3.0, ...
$backuprelease = $this->get_task()->get_info()->backup_release; // The major version: 2.9, 3.0, 3.10...
$backupbuild = 0;
preg_match('/(\d{8})/', $this->get_task()->get_info()->moodle_release, $matches);
if (!empty($matches[1])) {
@@ -132,7 +132,7 @@ class restore_gradebook_structure_step extends restore_structure_step {
// On older versions the freeze value has to be converted.
// We do this from here as it is happening right before the file is read.
// This only targets the backup files that can contain the legacy freeze.
if ($backupbuild > 20150618 && ($backuprelease < 3.0 || $backupbuild < 20160527)) {
if ($backupbuild > 20150618 && (version_compare($backuprelease, '3.0', '<') || $backupbuild < 20160527)) {
$this->rewrite_step_backup_file_for_legacy_freeze($fullpath);
}
@@ -505,8 +505,7 @@ class restore_gradebook_structure_step extends restore_structure_step {
$gradebookcalculationsfreeze = get_config('core', 'gradebook_calculations_freeze_' . $this->get_courseid());
preg_match('/(\d{8})/', $this->get_task()->get_info()->moodle_release, $matches);
$backupbuild = (int)$matches[1];
// The function floatval will return a float even if there is text mixed with the release number.
$backuprelease = floatval($this->get_task()->get_info()->backup_release);
$backuprelease = $this->get_task()->get_info()->backup_release; // The major version: 2.9, 3.0, 3.10...
// Extra credits need adjustments only for backups made between 2.8 release (20141110) and the fix release (20150619).
if (!$gradebookcalculationsfreeze && $backupbuild >= 20141110 && $backupbuild < 20150619) {
@@ -521,7 +520,7 @@ class restore_gradebook_structure_step extends restore_structure_step {
// Courses from before 3.1 (20160518) may have a letter boundary problem and should be checked for this issue.
// Backups from before and including 2.9 could have a build number that is greater than 20160518 and should
// be checked for this problem.
if (!$gradebookcalculationsfreeze && ($backupbuild < 20160518 || $backuprelease <= 2.9)) {
if (!$gradebookcalculationsfreeze && ($backupbuild < 20160518 || version_compare($backuprelease, '2.9', '<='))) {
require_once($CFG->libdir . '/db/upgradelib.php');
upgrade_course_letter_boundary($this->get_courseid());
}
@@ -4631,11 +4630,11 @@ class restore_create_categories_and_questions extends restore_structure_step {
// Before 3.5, question categories could be created at top level.
// From 3.5 onwards, all question categories should be a child of a special category called the "top" category.
$backuprelease = floatval($this->get_task()->get_info()->backup_release);
$backuprelease = $this->get_task()->get_info()->backup_release; // The major version: 2.9, 3.0, 3.10...
preg_match('/(\d{8})/', $this->get_task()->get_info()->moodle_release, $matches);
$backupbuild = (int)$matches[1];
$before35 = false;
if ($backuprelease < 3.5 || $backupbuild < 20180205) {
if (version_compare($backuprelease, '3.5', '<') || $backupbuild < 20180205) {
$before35 = true;
}
if (empty($mapping->info->parent) && $before35) {
@@ -4892,11 +4891,11 @@ class restore_move_module_questions_categories extends restore_execution_step {
protected function define_execution() {
global $DB;
$backuprelease = floatval($this->task->get_info()->backup_release);
$backuprelease = $this->task->get_info()->backup_release; // The major version: 2.9, 3.0, 3.10...
preg_match('/(\d{8})/', $this->task->get_info()->moodle_release, $matches);
$backupbuild = (int)$matches[1];
$after35 = false;
if ($backuprelease >= 3.5 && $backupbuild > 20180205) {
if (version_compare($backuprelease, '3.5', '>=') && $backupbuild > 20180205) {
$after35 = true;
}
+2 -2
View File
@@ -581,11 +581,11 @@ abstract class restore_dbops {
$rc = restore_controller_dbops::load_controller($restoreid);
$restoreinfo = $rc->get_info();
$rc->destroy(); // Always need to destroy.
$backuprelease = floatval($restoreinfo->backup_release);
$backuprelease = $restoreinfo->backup_release; // The major version: 2.9, 3.0, 3.10...
preg_match('/(\d{8})/', $restoreinfo->moodle_release, $matches);
$backupbuild = (int)$matches[1];
$after35 = false;
if ($backuprelease >= 3.5 && $backupbuild > 20180205) {
if (version_compare($backuprelease, '3.5', '>=') && $backupbuild > 20180205) {
$after35 = true;
}
@@ -48,8 +48,8 @@ class restore_format_topics_plugin extends restore_format_plugin {
*/
protected function need_restore_numsections() {
$backupinfo = $this->step->get_task()->get_info();
$backuprelease = $backupinfo->backup_release;
return version_compare($backuprelease, '3.3', 'lt');
$backuprelease = $backupinfo->backup_release; // The major version: 2.9, 3.0, 3.10...
return version_compare($backuprelease, '3.3', '<');
}
/**
@@ -48,8 +48,8 @@ class restore_format_weeks_plugin extends restore_format_plugin {
*/
protected function is_pre_33_backup() {
$backupinfo = $this->step->get_task()->get_info();
$backuprelease = $backupinfo->backup_release;
return version_compare($backuprelease, '3.3', 'lt');
$backuprelease = $backupinfo->backup_release; // The major version: 2.9, 3.0, 3.10...
return version_compare($backuprelease, '3.3', '<');
}
/**