mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-42192 accesslib: tweak get_all_capabilities
Tony thinks its bike shed painting, I think its a bit more readable and memory efficient. I am using integrator dictatorship for sure.
This commit is contained in:
parent
a6661ae013
commit
a0dffaa946
@ -2976,18 +2976,19 @@ function get_capability_info($capabilityname) {
|
||||
/**
|
||||
* Returns all capabilitiy records, preferably from MUC and not database.
|
||||
*
|
||||
* @return array All capability records
|
||||
* @return array All capability records indexed by capability name
|
||||
*/
|
||||
function get_all_capabilities() {
|
||||
global $DB;
|
||||
$cache = cache::make('core', 'capabilities');
|
||||
if (!$allcaps = $cache->get('core_capabilities')) {
|
||||
$allcaps = $DB->get_records('capabilities', null, '', 'name as uniquename, *');
|
||||
foreach ($allcaps as $k => $v) {
|
||||
unset($v->uniquename);
|
||||
$v->riskbitmask = (int) $v->riskbitmask;
|
||||
$allcaps[$k] = (array) $v;
|
||||
$rs = $DB->get_recordset('capabilities');
|
||||
$allcaps = array();
|
||||
foreach ($rs as $capability) {
|
||||
$capability->riskbitmask = (int) $capability->riskbitmask;
|
||||
$allcaps[$capability->name] = (array) $capability;
|
||||
}
|
||||
$rs->close();
|
||||
$cache->set('core_capabilities', $allcaps);
|
||||
}
|
||||
return $allcaps;
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2015061200.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2015061600.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user