Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'wip-MDL-40136-m25' of git://github.com/samhemelryk/mood…

…le into MOODLE_25_STABLE
commit e38c37939a556a5f6091121ddf31ef2f7de74a9d 2 parents e15bf9b + 43dc7aa
Dan Poltawski danpoltawski authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/moodlelib.php
16 lib/moodlelib.php
View
@@ -8219,7 +8219,14 @@ function get_plugin_types($fullpaths=true) {
$cache = cache::make('core', 'plugintypes');
if ($fullpaths) {
- $cached = $cache->get(1);
+ // First confirm that dirroot and the stored dirroot match.
+ if ($CFG->dirroot === $cache->get('dirroot')) {
+ // They match we can use it.
+ $cached = $cache->get(1);
+ } else {
+ // Oops they didn't match. The moodle directory has been moved on us.
+ $cached = false;
+ }
} else {
$cached = $cache->get(0);
}
@@ -8279,6 +8286,9 @@ function get_plugin_types($fullpaths=true) {
$cache->set(0, $info);
$cache->set(1, $fullinfo);
+ // We cache the dirroot as well so that we can compare it when we
+ // retrieve full info from the cache.
+ $cache->set('dirroot', $CFG->dirroot);
return ($fullpaths ? $fullinfo : $info);
}
@@ -8301,7 +8311,9 @@ function is_valid_plugin_name($name) {
function get_plugin_list($plugintype) {
global $CFG;
- $cache = cache::make('core', 'pluginlist');
+ // We use the dirroot as an identifier here because if it has changed the whole cache
+ // can be considered invalid.
+ $cache = cache::make('core', 'pluginlist', array('dirroot' => $CFG->dirroot));
$cached = $cache->get($plugintype);
if ($cached !== false) {
return $cached;
Please sign in to comment.
Something went wrong with that request. Please try again.