diff --git a/lib/db/caches.php b/lib/db/caches.php index fa713213ebe..6ba8d843326 100644 --- a/lib/db/caches.php +++ b/lib/db/caches.php @@ -105,11 +105,23 @@ $definitions = array( '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, + ), ); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 5e894392e4f..99950f1976f 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -8248,6 +8248,12 @@ function get_plugin_types($fullpaths=true) { 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. @@ -8281,10 +8287,12 @@ function get_plugin_list($plugintype) { } 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; @@ -8317,6 +8325,7 @@ function get_plugin_list($plugintype) { //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; } @@ -9119,7 +9128,11 @@ function moodle_needs_upgrading() { 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) { diff --git a/version.php b/version.php index 64f42bb1c14..68e5579b21a 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ 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