mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
MDL-31360 Don't use get_in_or_equal if array is empty, tidy up structure of $extracaps array
This commit is contained in:
parent
d4b3034bb4
commit
68e719927e
1 changed files with 8 additions and 8 deletions
|
@ -6380,6 +6380,7 @@ class context_module extends context {
|
||||||
}
|
}
|
||||||
|
|
||||||
$modfile = "$CFG->dirroot/mod/$module->name/lib.php";
|
$modfile = "$CFG->dirroot/mod/$module->name/lib.php";
|
||||||
|
$extracaps = array();
|
||||||
if (file_exists($modfile)) {
|
if (file_exists($modfile)) {
|
||||||
include_once($modfile);
|
include_once($modfile);
|
||||||
$modfunction = $module->name.'_get_extra_capabilities';
|
$modfunction = $module->name.'_get_extra_capabilities';
|
||||||
|
@ -6387,16 +6388,15 @@ class context_module extends context {
|
||||||
$extracaps = $modfunction();
|
$extracaps = $modfunction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($extracaps)) {
|
|
||||||
$extracaps = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$extracaps = array_merge($subcaps, $extracaps);
|
$extracaps = array_merge($subcaps, $extracaps);
|
||||||
|
$extra = '';
|
||||||
|
$params = array();
|
||||||
|
if (!empty($extracaps)) {
|
||||||
list($extra, $params) = $DB->get_in_or_equal(
|
list($extra, $params) = $DB->get_in_or_equal(
|
||||||
$extracaps, SQL_PARAMS_NAMED, 'cap0');
|
$extracaps, SQL_PARAMS_NAMED, 'cap0');
|
||||||
$extra = "OR name $extra";
|
$extra = "OR name $extra";
|
||||||
|
}
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM {capabilities}
|
FROM {capabilities}
|
||||||
WHERE (contextlevel = ".CONTEXT_MODULE."
|
WHERE (contextlevel = ".CONTEXT_MODULE."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue