Commit 7eab3c65 authored by Andrew Robert Nicols's avatar Andrew Robert Nicols
Browse files

Check that we have something to loop over during upgrade (Closes #628921).


Signed-off-by: default avatarAndrew Robert Nicols <andrew.nicols@luns.net.uk>
parent e2d22947
......@@ -1904,7 +1904,10 @@ function xmldb_core_upgrade($oldversion=0) {
unset($viewdata->owner);
$viewdata->template = 0;
foreach (get_records_array('group', '', '', '', 'id,public') as $group) {
if (!$groups = get_records_array('group', '', '', '', 'id,public')) {
$groups = array();
}
foreach ($groups as $group) {
$viewdata->group = $group->id;
$id = insert_record('view', $viewdata, 'id', true);
insert_record('view_access', (object) array(
......@@ -2023,11 +2026,13 @@ function xmldb_core_upgrade($oldversion=0) {
drop_table($table);
// Insert explicit tutor access records for submitted views
$submittedviews = get_records_sql_array('
if (!$submittedviews = get_records_sql_array('
SELECT v.id, v.submittedgroup, g.grouptype
FROM {view} v JOIN {group} g ON (v.submittedgroup = g.id AND g.deleted = 0)',
array()
);
)) {
$submittedviews = array();
}
$roles = array();
foreach ($submittedviews as $v) {
if (!isset($roles[$v->grouptype])) {
......
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