Commit bb250f02 authored by Sam Hemelryk's avatar Sam Hemelryk
Browse files

MDL-25290 cache: Added optional CFG setting to control location of cache config file

parent 167ad91e
......@@ -105,6 +105,17 @@ class cache_config {
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';
......@@ -411,6 +411,17 @@ $CFG->admin = 'admin';
// $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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment