Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-43530 cache: Cache multiple different dirroots

In some clustered environments (Amazon OpsWorks) the deployment
folders on different nodes use different file paths.  As we cache
the realpath in the shared MUC, you don't always get the right answer.

We now cache each dirroot in it's own full path location to allow
each node to get the correct file locations for itself.
  • Loading branch information...
commit 2f86a952d78beebf4bca7891f6ab97868e7bf0c9 1 parent e92da00
Russell Smith authored
Showing with 4 additions and 12 deletions.
  1. +4 −12 lib/moodlelib.php
View
16 lib/moodlelib.php
@@ -8227,14 +8227,9 @@ function get_plugin_types($fullpaths=true) {
$cache = cache::make('core', 'plugintypes');
if ($fullpaths) {
- // 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;
- }
+ // Cache each dirroot separately in case cluster nodes happen to be deployed to
+ // different locations.
+ $cached = $cache->get(sha1($CFG->dirroot));
} else {
$cached = $cache->get(0);
}
@@ -8293,10 +8288,7 @@ 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);
+ $cache->set(sha1($CFG->dirroot), $fullinfo);
return ($fullpaths ? $fullinfo : $info);
}
Please sign in to comment.
Something went wrong with that request. Please try again.