Merge branch 'MDL-28180_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE
This commit is contained in:
@@ -293,6 +293,14 @@ class backup_controller extends backup implements loggable {
|
||||
// Basic/initial prevention against time/memory limits
|
||||
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
// If this is not a course backup, inform the plan we are not
|
||||
// including all the activities for sure. This will affect any
|
||||
// task/step executed conditionally to stop including information
|
||||
// for section and activity backup. MDL-28180.
|
||||
if ($this->get_type() !== backup::TYPE_1COURSE) {
|
||||
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
|
||||
$this->plan->set_excluding_activities();
|
||||
}
|
||||
return $this->plan->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -299,6 +299,14 @@ class restore_controller extends backup implements loggable {
|
||||
// Basic/initial prevention against time/memory limits
|
||||
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
// If this is not a course restore, inform the plan we are not
|
||||
// including all the activities for sure. This will affect any
|
||||
// task/step executed conditionally to stop processing information
|
||||
// for section and activity restore. MDL-28180.
|
||||
if ($this->get_type() !== backup::TYPE_1COURSE) {
|
||||
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
|
||||
$this->plan->set_excluding_activities();
|
||||
}
|
||||
return $this->plan->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -1805,15 +1805,20 @@ class restore_course_completion_structure_step extends restore_structure_step {
|
||||
|
||||
$data->course = $this->get_courseid();
|
||||
|
||||
$params = array(
|
||||
'course' => $data->course,
|
||||
'criteriatype' => $data->criteriatype,
|
||||
'method' => $data->method,
|
||||
'value' => $data->value,
|
||||
);
|
||||
$DB->insert_record('course_completion_aggr_methd', $params);
|
||||
// Only create the course_completion_aggr_methd records if
|
||||
// the target course has not them defined. MDL-28180
|
||||
if (!$DB->record_exists('course_completion_aggr_methd', array(
|
||||
'course' => $data->course,
|
||||
'criteriatype' => $data->criteriatype))) {
|
||||
$params = array(
|
||||
'course' => $data->course,
|
||||
'criteriatype' => $data->criteriatype,
|
||||
'method' => $data->method,
|
||||
'value' => $data->value,
|
||||
);
|
||||
$DB->insert_record('course_completion_aggr_methd', $params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class backup_plan extends base_plan implements loggable {
|
||||
}
|
||||
$this->controller = $controller;
|
||||
$this->basepath = $CFG->tempdir . '/backup/' . $controller->get_backupid();
|
||||
$this->excludingdactivities = false;
|
||||
parent::__construct('backup_plan');
|
||||
}
|
||||
|
||||
|
||||
@@ -6951,6 +6951,34 @@ FROM
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
if ($oldversion < 2011120500.02) {
|
||||
|
||||
upgrade_set_timeout(60*20); // This may take a while
|
||||
// MDL-28180. Some missing restrictions in certain backup & restore operations
|
||||
// were causing incorrect duplicates in the course_completion_aggr_methd table.
|
||||
// This upgrade step takes rid of them.
|
||||
$sql = 'SELECT course, criteriatype, MIN(id) AS minid
|
||||
FROM {course_completion_aggr_methd}
|
||||
GROUP BY course, criteriatype
|
||||
HAVING COUNT(*) > 1';
|
||||
$duprs = $DB->get_recordset_sql($sql);
|
||||
foreach ($duprs as $duprec) {
|
||||
// We need to handle NULLs in criteriatype diferently
|
||||
if (is_null($duprec->criteriatype)) {
|
||||
$where = 'course = ? AND criteriatype IS NULL AND id > ?';
|
||||
$params = array($duprec->course, $duprec->minid);
|
||||
} else {
|
||||
$where = 'course = ? AND criteriatype = ? AND id > ?';
|
||||
$params = array($duprec->course, $duprec->criteriatype, $duprec->minid);
|
||||
}
|
||||
$DB->delete_records_select('course_completion_aggr_methd', $where, $params);
|
||||
}
|
||||
$duprs->close();
|
||||
|
||||
// Main savepoint reached
|
||||
upgrade_main_savepoint(true, 2011120500.02);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$version = 2011120500.01; // 20111205 = branching date YYYYMMDD - do not modify!
|
||||
$version = 2011120500.02; // 20111205 = branching date YYYYMMDD - do not modify!
|
||||
// RR = release increments - 00 in DEV branches
|
||||
// .XX = incremental changes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user