MDL-9842 Groups from groupings not moved to "Not in a grouping"
This commit is contained in:
@@ -48,6 +48,33 @@ function install_group_db() {
|
||||
notify(get_string('databaseupgradegroups', '', $group_version), 'green');
|
||||
}
|
||||
|
||||
function undo_groupings() {
|
||||
global $CFG;
|
||||
|
||||
if (!$rs = get_recordset_sql("
|
||||
SELECT gpgs.courseid, ggs.groupid
|
||||
FROM {$CFG->prefix}groups_courses_groupings gpgs,
|
||||
{$CFG->prefix}groups_groupings_groups ggs
|
||||
WHERE gpgs.groupingid = ggs.groupingid")) {
|
||||
//strange - did we already remove the tables?
|
||||
return;
|
||||
}
|
||||
|
||||
$db->debug = false;
|
||||
if ($rs && $rs->RecordCount() > 0) {
|
||||
while ($group = rs_fetch_next_record($rs)) {
|
||||
if (!record_exists('groups_courses_groups', 'courseid', $group->courseid, 'groupid', $group->groupid)) {
|
||||
insert_record('groups_courses_groups', $group);
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->debug = true;
|
||||
|
||||
delete_records('groups_courses_groupings');
|
||||
delete_records('groups_groupings_groups');
|
||||
delete_records('groups_groupings');
|
||||
}
|
||||
|
||||
|
||||
function upgrade_group_db($continueto) {
|
||||
/// This function upgrades the group tables, if necessary
|
||||
|
||||
@@ -671,6 +671,15 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2007021504) {
|
||||
if (empty($CFG->enablegroupings)) {
|
||||
// delete all groupings - they do not work yet :-(
|
||||
// while keeping all existing groups
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
undo_groupings();
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2007021503; // YYYYMMDD = date of the 1.8 branch (don't change)
|
||||
$version = 2007021504; // YYYYMMDD = date of the 1.8 branch (don't change)
|
||||
// X = release number 1.8.[0,1,2,3...]
|
||||
// Y = micro-increments between releases
|
||||
|
||||
|
||||
Reference in New Issue
Block a user