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";
}
}
// 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
}
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
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);
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);
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');
if (empty($CFG->early_install_lang)) {
if (empty($CFG->langcacheroot)) {
- $langcacheroot = $CFG->dataroot . '/cache/lang';
+ $langcacheroot = $CFG->cachedir . '/lang';
} else {
$langcacheroot = $CFG->langcacheroot;
}
}
if (empty($CFG->langmenucachefile)) {
- $langmenucache = $CFG->dataroot . '/cache/languages';
+ $langmenucache = $CFG->cachedir . '/languages';
} else {
$langmenucache = $CFG->langmenucachefile;
}
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");
}
/**
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));
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");
}
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 . '/');
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))) {
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) {
private static function get_cache_directory() {
global $CFG;
- return $CFG->dataroot.'/cache/simplepie/';
+ return $CFG->cachedir.'/simplepie/';
}
/**
global $CFG, $DB;
$DB->delete_records('cache_text');
- $purifdir = $CFG->dataroot.'/cache/htmlpurifier';
+ $purifdir = $CFG->cachedir.'/htmlpurifier';
remove_dir($purifdir, true);
}
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';
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")) {
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'])) {
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'])) {
$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);
// 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();