mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
Merge branch 'MDL-48549_master' of git://github.com/markn86/moodle
This commit is contained in:
commit
b301753ba9
@ -584,5 +584,37 @@ function xmldb_assign_upgrade($oldversion) {
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014122600) {
|
||||
// Delete any entries from the assign_user_flags and assign_user_mapping that are no longer required.
|
||||
if ($DB->get_dbfamily() === 'mysql') {
|
||||
$sql1 = "DELETE {assign_user_flags}
|
||||
FROM {assign_user_flags}
|
||||
LEFT JOIN {assign}
|
||||
ON {assign_user_flags}.assignment = {assign}.id
|
||||
WHERE {assign}.id IS NULL";
|
||||
|
||||
$sql2 = "DELETE {assign_user_mapping}
|
||||
FROM {assign_user_mapping}
|
||||
LEFT JOIN {assign}
|
||||
ON {assign_user_mapping}.assignment = {assign}.id
|
||||
WHERE {assign}.id IS NULL";
|
||||
} else {
|
||||
$sql1 = "DELETE FROM {assign_user_flags}
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 'x' FROM {assign}
|
||||
WHERE {assign_user_flags}.assignment = {assign}.id)";
|
||||
|
||||
$sql2 = "DELETE FROM {assign_user_mapping}
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 'x' FROM {assign}
|
||||
WHERE {assign_user_mapping}.assignment = {assign}.id)";
|
||||
}
|
||||
|
||||
$DB->execute($sql1);
|
||||
$DB->execute($sql2);
|
||||
|
||||
upgrade_mod_savepoint(true, 2014122600, 'assign');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -700,9 +700,11 @@ class assign {
|
||||
}
|
||||
|
||||
// Delete_records will throw an exception if it fails - so no need for error checking here.
|
||||
$DB->delete_records('assign_submission', array('assignment'=>$this->get_instance()->id));
|
||||
$DB->delete_records('assign_grades', array('assignment'=>$this->get_instance()->id));
|
||||
$DB->delete_records('assign_plugin_config', array('assignment'=>$this->get_instance()->id));
|
||||
$DB->delete_records('assign_submission', array('assignment' => $this->get_instance()->id));
|
||||
$DB->delete_records('assign_grades', array('assignment' => $this->get_instance()->id));
|
||||
$DB->delete_records('assign_plugin_config', array('assignment' => $this->get_instance()->id));
|
||||
$DB->delete_records('assign_user_flags', array('assignment' => $this->get_instance()->id));
|
||||
$DB->delete_records('assign_user_mapping', array('assignment' => $this->get_instance()->id));
|
||||
|
||||
// Delete items from the gradebook.
|
||||
if (! $this->delete_grades()) {
|
||||
@ -761,19 +763,18 @@ class assign {
|
||||
}
|
||||
}
|
||||
|
||||
$assignssql = 'SELECT a.id
|
||||
FROM {assign} a
|
||||
WHERE a.course=:course';
|
||||
$params = array('course'=>$data->courseid);
|
||||
$assignids = $DB->get_records('assign', array('course' => $data->courseid), '', 'id');
|
||||
list($sql, $params) = $DB->get_in_or_equal(array_keys($assignids));
|
||||
|
||||
$DB->delete_records_select('assign_submission', "assignment IN ($assignssql)", $params);
|
||||
$DB->delete_records_select('assign_submission', "assignment $sql", $params);
|
||||
$DB->delete_records_select('assign_user_flags', "assignment $sql", $params);
|
||||
|
||||
$status[] = array('component'=>$componentstr,
|
||||
'item'=>get_string('deleteallsubmissions', 'assign'),
|
||||
'error'=>false);
|
||||
|
||||
if (!empty($data->reset_gradebook_grades)) {
|
||||
$DB->delete_records_select('assign_grades', "assignment IN ($assignssql)", $params);
|
||||
$DB->delete_records_select('assign_grades', "assignment $sql", $params);
|
||||
// Remove all grades from gradebook.
|
||||
require_once($CFG->dirroot.'/mod/assign/lib.php');
|
||||
assign_reset_gradebook($data->courseid);
|
||||
|
@ -25,8 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->version = 2014111000; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2014122600; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->cron = 60;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user