Browse files

MDL-25290 cache: Added optional CFG setting to control location of ca…

…che config file
  • Loading branch information...
1 parent 167ad91 commit bb250f02e658f25a050021bfafd9f486edd37924 Sam Hemelryk committed Sep 18, 2012
Showing with 22 additions and 0 deletions.
  1. +11 −0 cache/classes/config.php
  2. +11 −0 config-dist.php
View
11 cache/classes/config.php
@@ -105,6 +105,17 @@ public static function config_file_exists() {
*/
protected static function get_config_file_path() {
global $CFG;
+ if (!empty($CFG->altcacheconfigpath)) {
+ $path = $CFG->altcacheconfigpath;
+ if (is_dir($path) && is_writable($path)) {
+ // Its a writable directory, thats fine.
+ return $path.'/cacheconfig.php';
+ } else if (is_writable(dirname($path)) && (!file_exists($path) || is_writable($path))) {
+ // Its a file, either it doesn't exist and the directory is writable or the file exists and is writable.
+ return $path;
+ }
+ }
+ // Return the default location within dataroot.
return $CFG->dataroot.'/muc/config.php';
}
View
11 config-dist.php
@@ -411,6 +411,17 @@
//
// $CFG->extramemorylimit = '1G';
//
+// Moodle 2.4 introduced a new cache API.
+// The cache API stores a configuration file within the Moodle data directory and
+// uses that rather than the database in order to function in a stand-alone manner.
+// Using altcacheconfigpath you can change the location where this config file is
+// looked for.
+// It can either be a directory in which to store the file, or the full path to the
+// file if you want to take full control. Either way it must be writable by the
+// webserver.
+//
+// $CFG->altcacheconfigpath = '/var/www/shared/moodle.cache.config.php
+//
// The CSS files the Moodle produces can be extremely large and complex, especially
// if you are using a custom theme that builds upon several other themes.
// In Moodle 2.3 a CSS optimiser was added as an experimental feature for advanced

0 comments on commit bb250f0

Please sign in to comment.