mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-16369 Added error info in accesslib
This commit is contained in:
parent
6511446349
commit
f689028c7e
1 changed files with 13 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue