MDL-16369 Added error info in accesslib

This commit is contained in:
nicolasconnault 2008-09-06 13:17:15 +00:00
parent 6511446349
commit f689028c7e

View file

@ -1936,6 +1936,7 @@ function create_context($contextlevel, $instanceid) {
$basedepth = 1;
$result = true;
$error_message = null;
switch ($contextlevel) {
case CONTEXT_COURSECAT:
@ -1961,6 +1962,7 @@ function create_context($contextlevel, $instanceid) {
}
} else {
// incorrect category id
$error_message = "incorrect course category id ($instanceid)";
$result = false;
}
break;
@ -1991,6 +1993,7 @@ function create_context($contextlevel, $instanceid) {
return false;
} else {
// incorrect course id
$error_message = "incorrect course id ($instanceid)";
$result = false;
}
break;
@ -2011,10 +2014,12 @@ function create_context($contextlevel, $instanceid) {
$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;
@ -2038,10 +2043,12 @@ function create_context($contextlevel, $instanceid) {
$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;
@ -2065,7 +2072,8 @@ function create_context($contextlevel, $instanceid) {
} else {
debugging('Error: could not insert new context level "'.
s($contextlevel).'", instance "'.
s($instanceid).'".');
s($instanceid).'". ' . $error_message);
return false;
}
}