Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-32827-m23' of git://github.com/ankitagarwal/moodle …

…into MOODLE_23_STABLE
  • Loading branch information...
commit dddd0d7a38a853b34f09e2203adfe0a79ec2a3cc 2 parents 1de0c00 + 669f274
Sam Hemelryk samhemelryk authored
17 backup/moodle2/restore_stepslib.php
View
@@ -1737,6 +1737,23 @@ public function process_calendarevents($data) {
return;
}
}
+ // Handle events with empty eventtype //MDL-32827
+ if(empty($data->eventtype)) {
+ if ($data->courseid == $SITE->id) { // Site event
+ $data->eventtype = "site";
+ } else if ($data->courseid != 0 && $data->groupid == 0 && ($data->modulename == 'assignment' || $data->modulename == 'assign')) {
+ // Course assingment event
+ $data->eventtype = "due";
+ } else if ($data->courseid != 0 && $data->groupid == 0) { // Course event
+ $data->eventtype = "course";
+ } else if ($data->groupid) { // Group event
+ $data->eventtype = "group";
+ } else if ($data->userid) { // User event
+ $data->eventtype = "user";
+ } else {
+ return;
+ }
+ }
$params = array(
'name' => $data->name,
16 lib/db/upgrade.php
View
@@ -85,7 +85,7 @@
* @return bool always true
*/
function xmldb_main_upgrade($oldversion) {
- global $CFG, $USER, $DB, $OUTPUT;
+ global $CFG, $USER, $DB, $OUTPUT, $SITE;
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions
@@ -923,5 +923,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012062501.04);
}
+ if ($oldversion < 2012062501.06) {
+
+ // Handle events with empty eventtype MDL-32827
+
+ $DB->set_field('event', 'eventtype', 'site', array('eventtype' => '', 'courseid' => $SITE->id));
+ $DB->set_field_select('event', 'eventtype', 'due', "eventtype = '' AND courseid != 0 AND groupid = 0 AND (modulename = 'assignment' OR modulename = 'assign')");
+ $DB->set_field_select('event', 'eventtype', 'course', "eventtype = '' AND courseid != 0 AND groupid = 0");
+ $DB->set_field_select('event', 'eventtype', 'group', "eventtype = '' AND groupid != 0");
+ $DB->set_field_select('event', 'eventtype', 'user', "eventtype = '' AND userid != 0");
+
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2012062501.06);
+ }
+
return true;
}
2  version.php
View
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2012062501.05; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2012062501.06; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes
Please sign in to comment.
Something went wrong with that request. Please try again.