mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +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;
|
$basedepth = 1;
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
$error_message = null;
|
||||||
|
|
||||||
switch ($contextlevel) {
|
switch ($contextlevel) {
|
||||||
case CONTEXT_COURSECAT:
|
case CONTEXT_COURSECAT:
|
||||||
|
@ -1961,6 +1962,7 @@ function create_context($contextlevel, $instanceid) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// incorrect category id
|
// incorrect category id
|
||||||
|
$error_message = "incorrect course category id ($instanceid)";
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1991,6 +1993,7 @@ function create_context($contextlevel, $instanceid) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// incorrect course id
|
// incorrect course id
|
||||||
|
$error_message = "incorrect course id ($instanceid)";
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2011,10 +2014,12 @@ function create_context($contextlevel, $instanceid) {
|
||||||
$basedepth = $parent->depth;
|
$basedepth = $parent->depth;
|
||||||
} else {
|
} else {
|
||||||
// course does not exist - modules can not exist without a course
|
// 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;
|
$result = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// cm does not exist
|
// cm does not exist
|
||||||
|
$error_message = "cm with id $instanceic does not exist";
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2038,10 +2043,12 @@ function create_context($contextlevel, $instanceid) {
|
||||||
$basedepth = $parent->depth;
|
$basedepth = $parent->depth;
|
||||||
} else {
|
} else {
|
||||||
// parent course does not exist - course blocks can not exist without a course
|
// 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;
|
$result = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// block does not exist
|
// block does not exist
|
||||||
|
$error_message = 'block does not exist';
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2065,7 +2072,8 @@ function create_context($contextlevel, $instanceid) {
|
||||||
} else {
|
} else {
|
||||||
debugging('Error: could not insert new context level "'.
|
debugging('Error: could not insert new context level "'.
|
||||||
s($contextlevel).'", instance "'.
|
s($contextlevel).'", instance "'.
|
||||||
s($instanceid).'".');
|
s($instanceid).'". ' . $error_message);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue