'persistent' => true, // Likely there will be a couple of calls to this.
'persistmaxsize' => 2, // The original cache used 1, we've increased that to two.
),
- // Used to cache calendar subscriptions.
+
+ // Used to cache calendar subscriptions.
'calendar_subscriptions' => array(
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true,
'persistent' => true,
- )
+ ),
+
+ // Cache for the list of installed plugins - {@see get_plugin_list()}.
+ // The key consists of the plugin type string (e.g. mod, block, enrol etc).
+ // The value is an associative array of plugin name => plugin location.
+ 'pluginlist' => array(
+ 'mode' => cache_store::MODE_APPLICATION,
+ 'simplekeys' => true,
+ 'simpledata' => true,
+ 'persistent' => true,
+ 'persistentmaxsize' => 2,
+ ),
);
function get_plugin_list($plugintype) {
global $CFG;
+ $cache = cache::make('core', 'pluginlist');
+ $cached = $cache->get($plugintype);
+ if ($cached !== false) {
+ return $cached;
+ }
+
$ignored = array('CVS', '_vti_cnf', 'simpletest', 'db', 'yui', 'tests');
if ($plugintype == 'auth') {
// Historically we have had an auth plugin called 'db', so allow a special case.
} else {
$types = get_plugin_types(true);
if (!array_key_exists($plugintype, $types)) {
+ $cache->set($plugintype, array());
return array();
}
$fulldir = $types[$plugintype];
if (!file_exists($fulldir)) {
+ $cache->set($plugintype, array());
return array();
}
$fulldirs[] = $fulldir;
//TODO: implement better sorting once we migrated all plugin names to 'pluginname', ksort does not work for unicode, that is why we have to sort by the dir name, not the strings!
ksort($result);
+ $cache->set($plugintype, $result);
return $result;
}
return true;
}
- // main versio nfirst
+ // We have to purge plugin related caches now to be sure we have fresh data
+ // and new plugins can be detected.
+ cache::make('core', 'pluginlist')->purge();
+
+ // Check the main version first.
$version = null;
include($CFG->dirroot.'/version.php'); // defines $version and upgrades
if ($version > $CFG->version) {
defined('MOODLE_INTERNAL') || die();
-$version = 2013030800.00; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2013030800.01; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes