Permalink
Browse files

MDL-28701 Change all uses of $CFG->dataroot/cache to $CFG->cachedir

  • Loading branch information...
1 parent 383d388 commit 365bec4c06b28a31e60dd95216dd0d5db4558538 @tomlanyon tomlanyon committed with skodak Aug 10, 2011
View
@@ -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";
}
}
View
@@ -350,7 +350,7 @@
// 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
View
@@ -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
View
@@ -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);
View
@@ -67,7 +67,7 @@
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);
View
@@ -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;
}
View
@@ -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 @@ public function css_urls(moodle_page $page) {
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));
@@ -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");
}
View
@@ -67,7 +67,7 @@
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 . '/');
View
@@ -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) {
@@ -88,7 +88,7 @@ function __construct($feedurl = null) {
private static function get_cache_directory() {
global $CFG;
- return $CFG->dataroot.'/cache/simplepie/';
+ return $CFG->cachedir.'/simplepie/';
}
/**
View
@@ -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';
View
@@ -45,7 +45,7 @@
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")) {
View
@@ -46,7 +46,7 @@
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'])) {
View
@@ -50,7 +50,7 @@
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 @@
$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);
View
@@ -46,7 +46,7 @@
// 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();

0 comments on commit 365bec4

Please sign in to comment.