diff --git a/blog/rsslib.php b/blog/rsslib.php index 3fea97f3bfc..8e78674ab56 100644 --- a/blog/rsslib.php +++ b/blog/rsslib.php @@ -223,9 +223,9 @@ function blog_rss_file_name($type, $id, $tagid=0) { global $CFG; if ($tagid) { - return "$CFG->dataroot/cache/rss/blog/$type/$id/$tagid.xml"; + return "$CFG->cachedir/rss/blog/$type/$id/$tagid.xml"; } else { - return "$CFG->dataroot/cache/rss/blog/$type/$id.xml"; + return "$CFG->cachedir/rss/blog/$type/$id.xml"; } } diff --git a/config-dist.php b/config-dist.php index 4ca2b728e02..a35dcb3eb7b 100644 --- a/config-dist.php +++ b/config-dist.php @@ -350,7 +350,7 @@ $CFG->admin = 'admin'; // If $CFG->langstringcache is enabled (which should always be in production // environment), Moodle keeps aggregated strings in its own internal format // optimised for performance. By default, this on-disk cache is created in -// $CFG->dataroot/cache/lang. In cluster environment, you may wish to specify +// $CFG->cachedir/lang. In cluster environment, you may wish to specify // an alternative location of this cache so that each web server in the cluster // uses its own local cache and does not need to access the shared dataroot. // Make sure that the web server process has write permission to this location diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index a4f88097e60..47c35ae354e 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -124,7 +124,7 @@ function xmldb_main_upgrade($oldversion) { } if ($oldversion < 2008030602) { - @unlink($CFG->dataroot.'/cache/languages'); + @unlink($CFG->cachedir.'/languages'); if (file_exists("$CFG->dataroot/lang")) { // rename old lang directory so that the new and old langs do not mix diff --git a/lib/filelib.php b/lib/filelib.php index c53dd853bd1..02c350150c2 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -2935,9 +2935,9 @@ class curl_cache { function __construct($module = 'repository'){ global $CFG; if (!empty($module)) { - $this->dir = $CFG->dataroot.'/cache/'.$module.'/'; + $this->dir = $CFG->cachedir.'/'.$module.'/'; } else { - $this->dir = $CFG->dataroot.'/cache/misc/'; + $this->dir = $CFG->cachedir.'/misc/'; } if (!file_exists($this->dir)) { mkdir($this->dir, $CFG->directorypermissions, true); diff --git a/lib/javascript.php b/lib/javascript.php index 9e19def5719..02ab49a7f87 100644 --- a/lib/javascript.php +++ b/lib/javascript.php @@ -67,7 +67,7 @@ minify($jsfiles); function minify($files) { global $CFG; - $cachedir = $CFG->dataroot.'/cache/js'; + $cachedir = $CFG->cachedir.'/js'; // make sure the cache dir exist if (!file_exists($cachedir)) { @mkdir($cachedir, $CFG->directorypermissions, true); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a5e75b316af..4b46297fabb 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1370,7 +1370,7 @@ function purge_all_caches() { get_string_manager()->reset_caches(); // purge all other caches: rss, simplepie, etc. - remove_dir($CFG->dataroot.'/cache', true); + remove_dir($CFG->cachedir.'', true); // make sure cache dir is writable, throws exception if not make_upload_directory('cache'); @@ -5685,7 +5685,7 @@ function get_string_manager($forcereload=false) { if (empty($CFG->early_install_lang)) { if (empty($CFG->langcacheroot)) { - $langcacheroot = $CFG->dataroot . '/cache/lang'; + $langcacheroot = $CFG->cachedir . '/lang'; } else { $langcacheroot = $CFG->langcacheroot; } @@ -5697,7 +5697,7 @@ function get_string_manager($forcereload=false) { } if (empty($CFG->langmenucachefile)) { - $langmenucache = $CFG->dataroot . '/cache/languages'; + $langmenucache = $CFG->cachedir . '/languages'; } else { $langmenucache = $CFG->langmenucachefile; } diff --git a/lib/outputlib.php b/lib/outputlib.php index 8712d5ac903..8feae4c83d5 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -44,7 +44,7 @@ function theme_reset_all_caches() { require_once("$CFG->libdir/filelib.php"); set_config('themerev', empty($CFG->themerev) ? 1 : $CFG->themerev+1); - fulldelete("$CFG->dataroot/cache/theme"); + fulldelete("$CFG->cachedir/theme"); } /** @@ -613,7 +613,7 @@ class theme_config { if (!defined('THEME_DESIGNER_CACHE_LIFETIME')) { define('THEME_DESIGNER_CACHE_LIFETIME', 4); // this can be also set in config.php } - $candidatesheet = "$CFG->dataroot/cache/theme/$this->name/designer.ser"; + $candidatesheet = "$CFG->cachedir/theme/$this->name/designer.ser"; if (!file_exists($candidatesheet)) { $css = $this->css_content(); check_dir_exists(dirname($candidatesheet)); diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index fb8decbed48..5d9038428e8 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -1213,6 +1213,6 @@ function js_reset_all_caches() { require_once("$CFG->libdir/filelib.php"); set_config('jsrev', empty($CFG->jsrev) ? 1 : $CFG->jsrev+1); - fulldelete("$CFG->dataroot/cache/js"); + fulldelete("$CFG->cachedir/js"); } diff --git a/lib/pdflib.php b/lib/pdflib.php index 9c036aa386c..7444bc61a81 100644 --- a/lib/pdflib.php +++ b/lib/pdflib.php @@ -67,7 +67,7 @@ define('K_PATH_URL', $CFG->wwwroot . '/lib/tcpdf/'); define('K_PATH_FONTS', K_PATH_MAIN . 'fonts/'); /** cache directory for temporary files (full path) */ -define('K_PATH_CACHE', $CFG->dataroot . '/cache/'); +define('K_PATH_CACHE', $CFG->cachedir . '/'); /** images directory */ define('K_PATH_IMAGES', $CFG->dirroot . '/'); diff --git a/lib/rsslib.php b/lib/rsslib.php index 15dd6eb2832..5fb1bb19d29 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -92,7 +92,7 @@ function rss_print_link($contextid, $userid, $componentname, $id, $tooltiptext=' function rss_delete_file($componentname, $instance) { global $CFG; - $dirpath = "$CFG->dataroot/cache/rss/$componentname"; + $dirpath = "$CFG->cachedir/rss/$componentname"; if (is_dir($dirpath)) { $dh = opendir($dirpath); while (false !== ($filename = readdir($dh))) { @@ -170,7 +170,7 @@ function rss_save_file($componentname, $filename, $contents, $expandfilename=tru function rss_get_file_full_name($componentname, $filename) { global $CFG; - return "$CFG->dataroot/cache/rss/$componentname/$filename.xml"; + return "$CFG->cachedir/rss/$componentname/$filename.xml"; } function rss_get_file_name($instance, $sql) { diff --git a/lib/simplepie/moodle_simplepie.php b/lib/simplepie/moodle_simplepie.php index c6e1f6dafca..54e2d07ee3f 100644 --- a/lib/simplepie/moodle_simplepie.php +++ b/lib/simplepie/moodle_simplepie.php @@ -88,7 +88,7 @@ class moodle_simplepie extends SimplePie private static function get_cache_directory() { global $CFG; - return $CFG->dataroot.'/cache/simplepie/'; + return $CFG->cachedir.'/simplepie/'; } /** diff --git a/lib/weblib.php b/lib/weblib.php index d314ef249a1..fb51289efee 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1187,7 +1187,7 @@ function reset_text_filters_cache() { global $CFG, $DB; $DB->delete_records('cache_text'); - $purifdir = $CFG->dataroot.'/cache/htmlpurifier'; + $purifdir = $CFG->cachedir.'/htmlpurifier'; remove_dir($purifdir, true); } @@ -1514,7 +1514,7 @@ function purify_html($text, $options = array()) { if (empty($purifiers[$type])) { // make sure the serializer dir exists, it should be fine if it disappears later during cache reset - $cachedir = $CFG->dataroot.'/cache/htmlpurifier'; + $cachedir = $CFG->cachedir.'/htmlpurifier'; check_dir_exists($cachedir); require_once $CFG->libdir.'/htmlpurifier/HTMLPurifier.safe-includes.php'; diff --git a/theme/image.php b/theme/image.php index cac1765bd22..e00f5592f7f 100644 --- a/theme/image.php +++ b/theme/image.php @@ -45,7 +45,7 @@ if (file_exists("$CFG->dirroot/theme/$themename/config.php")) { image_not_found(); } -$candidatelocation = "$CFG->dataroot/cache/theme/$themename/pix/$component"; +$candidatelocation = "$CFG->cachedir/theme/$themename/pix/$component"; if ($rev > -1) { if (file_exists("$candidatelocation/$image.error")) { diff --git a/theme/javascript.php b/theme/javascript.php index 9b359a1f97a..6e8a79d785b 100644 --- a/theme/javascript.php +++ b/theme/javascript.php @@ -46,7 +46,7 @@ if (file_exists("$CFG->dirroot/theme/$themename/config.php")) { die('Theme was not found, sorry.'); } -$candidate = "$CFG->dataroot/cache/theme/$themename/javascript_$type.js"; +$candidate = "$CFG->cachedir/theme/$themename/javascript_$type.js"; if ($rev > -1 and file_exists($candidate)) { if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { diff --git a/theme/styles.php b/theme/styles.php index ce6ada05da9..6fcde59e1b6 100644 --- a/theme/styles.php +++ b/theme/styles.php @@ -50,7 +50,7 @@ if ($type === 'ie') { send_ie_css($themename, $rev); } -$candidatesheet = "$CFG->dataroot/cache/theme/$themename/css/$type.css"; +$candidatesheet = "$CFG->cachedir/theme/$themename/css/$type.css"; if (file_exists($candidatesheet)) { if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { @@ -97,11 +97,11 @@ if ($type === 'editor') { $cssfiles[] = $val; } } - $cssfile = "$CFG->dataroot/cache/theme/$themename/css/$key.css"; + $cssfile = "$CFG->cachedir/theme/$themename/css/$key.css"; store_css($theme, $cssfile, $cssfiles); $allfiles = array_merge($allfiles, $cssfiles); } - $cssfile = "$CFG->dataroot/cache/theme/$themename/css/all.css"; + $cssfile = "$CFG->cachedir/theme/$themename/css/all.css"; store_css($theme, $cssfile, $allfiles); } send_cached_css($candidatesheet, $rev); diff --git a/theme/styles_debug.php b/theme/styles_debug.php index 25a50e6a9b2..67277bc7262 100644 --- a/theme/styles_debug.php +++ b/theme/styles_debug.php @@ -46,7 +46,7 @@ if (file_exists("$CFG->dirroot/theme/$themename/config.php")) { // no gzip compression when debugging -$candidatesheet = "$CFG->dataroot/cache/theme/$themename/designer.ser"; +$candidatesheet = "$CFG->cachedir/theme/$themename/designer.ser"; if (!file_exists($candidatesheet)) { css_not_found();