Commit 32203095 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Removing unnecessary group code; cleaning up orphaned group content"

parents 8f9db969 2b0f183d
......@@ -62,10 +62,6 @@ class GroupTypeCourse extends GroupType {
return array('member', 'tutor', 'admin');
}
public static function get_view_editing_roles() {
return array('tutor', 'admin');
}
public static function get_view_moderating_roles() {
return array('tutor', 'admin');
}
......
......@@ -96,8 +96,6 @@ abstract class GroupType {
*/
public static abstract function get_roles();
public static abstract function get_view_editing_roles();
public static abstract function get_view_moderating_roles();
public static abstract function get_view_assessing_roles();
......
......@@ -60,10 +60,6 @@ class GroupTypeStandard extends GroupType {
return array('member', 'admin');
}
public static function get_view_editing_roles() {
return array('member', 'admin');
}
public static function get_view_moderating_roles() {
return array('admin');
}
......
......@@ -3449,5 +3449,35 @@ function xmldb_core_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2013100800) {
// Prior to Mahara 1.4, we did not delete group data when the group was deleted.
// So, let's just take a moment to clear that out now.
$deletedgroups = get_column('group', 'id', 'deleted', 1);
if ($deletedgroups) {
require_once(get_config('libroot') . 'group.php');
foreach ($deletedgroups as $groupid) {
// Temporarily set the group's "deleted" flag to 0 so that the group_delete()
// function can process it properly. By putting this inside a transaction we
// can make sure no page loads will see it as an active group. It should get
// set back to 0 by group_delete()
db_begin();
set_field('group', 'deleted', 0, 'id', $groupid);
try {
// Delete any remaining records for this group. Don't notify group members.
// This will have the side effect of double-munging the deleted group's
// name, but I think that's acceptable.
group_delete($groupid, null, null, false);
}
catch (Exception $e) {
// Out of an abundance of caution, try to catch any Exception that
// might happen while cleaning out these groups, and make sure the
// group remains set deleted at the end.
set_field('group', 'deleted', 1, 'id', $groupid);
}
db_commit();
}
}
}
return $status;
}
......@@ -31,7 +31,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2013093001;
$config->version = 2013100800;
$config->release = '1.8rc2dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
......@@ -325,15 +325,6 @@ class View {
if (empty($this->columnsperrow)) {
$this->columnsperrow = get_records_assoc('view_rows_columns', 'view', $this->get('id'), 'row', 'row, columns');
}
if ($this->group) {
$group = get_record('group', 'id', $this->group);
if ($group->deleted) {
throw new ViewNotFoundException(get_string('viewnotfound', 'error', $id));
}
safe_require('grouptype', $group->grouptype);
$this->editingroles = call_static_method('GroupType' . ucfirst($group->grouptype), 'get_view_editing_roles');
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment