/// Enclosing the 3-UNION into an inline_view to avoid column names conflict and making the ORDER BY cross-db
/// and to allow selection of TEXT columns in the query (MSSQL and Oracle limitation). MDL-16209
$sql = "
- SELECT $coursefields, ctxid, ctxpath, ctxdepth, ctxlevel, categorypath
+ SELECT $coursefields, ctxid, ctxpath, ctxdepth, ctxlevel, categorypath
FROM (
SELECT c.id,
ctx.id AS ctxid, ctx.path AS ctxpath,
$basedepth = 1;
$result = true;
+ $error_message = null;
switch ($contextlevel) {
case CONTEXT_COURSECAT:
}
} else {
// incorrect category id
+ $error_message = "incorrect course category id ($instanceid)";
$result = false;
}
break;
return false;
} else {
// incorrect course id
+ $error_message = "incorrect course id ($instanceid)";
$result = false;
}
break;
$basedepth = $parent->depth;
} else {
// course does not exist - modules can not exist without a course
+ $error_message = "course does not exist ($cm->course) - modules can not exist without a course";
$result = false;
}
} else {
// cm does not exist
+ $error_message = "cm with id $instanceic does not exist";
$result = false;
}
break;
$basedepth = $parent->depth;
} else {
// parent course does not exist - course blocks can not exist without a course
+ $error_message = 'parent course does not exist - course blocks can not exist without a course';
$result = false;
}
} else {
// block does not exist
+ $error_message = 'block does not exist';
$result = false;
}
break;
} else {
debugging('Error: could not insert new context level "'.
s($contextlevel).'", instance "'.
- s($instanceid).'".');
+ s($instanceid).'". ' . $error_message);
+
return false;
}
}
if (!has_capability('moodle/role:assign', $context)) {
return array();
- }
+ }
$parents = get_parent_contexts($context);
$parents[] = $context->id;
if (!has_capability('moodle/role:assign', $context)) {
return array();
- }
+ }
$parents = get_parent_contexts($context);
$parents[] = $context->id;
$updatesql = "UPDATE {context}
SET path = (SELECT path FROM {context_temp} WHERE id = {context}.id),
depth = (SELECT depth FROM {context_temp} WHERE id = {context}.id)
- WHERE id IN (SELECT id FROM mdl_context_temp)";
+ WHERE id IN (SELECT id FROM mdl_context_temp)";
}
// Top level categories