In an older Version I found:
if($removeAll && file_exists("../cache")) {
echo "Removing old cache... \n";
flush();
Filesystem::removeFolder("../cache", true);
echo "done.\n\n";
}
in 2.4.5 Line 87 it says:
if($removeAll && !isset($_GET['urls']) && $start == 0 && file_exists("../cache")) {
echo "Removing stale cache files... \n";
flush();
if (FilesystemPublisher::$domain_based_caching) {
// Glob each dir, then glob each one of those
foreach(glob(BASE_PATH . '/cache/*', GLOB_ONLYDIR) as $cacheDir) {
foreach(glob($cacheDir.'/*') as $cacheFile) {
$searchCacheFile = trim(str_replace($cacheBaseDir, '', $cacheFile), '\/');
if (!in_array($searchCacheFile, $mappedUrls)) {
echo " * Deleting $cacheFile\n";
@unlink($cacheFile);
}
}
}
} else {
}
echo "done.\n\n";
}
Why is the else code empty?
FilesystemPublisher::$domain_based_caching is false for default. Shouldn't there be somethink like this:
Filesystem::removeFolder("../cache", true);
Offtopic: Where to report bugs? I think 'General Questions' is not the correkt place?
Edit: I set:
FilesystemPublisher::$domain_based_caching = true;
In my config.php and changed Link() to AbsoluteLink() in Page->subPagesToCache():
function subPagesToCache($translate='all') {
$urls = array();
// add current page
if($this->nocache!=1){
$urls[] = $this->AbsoluteLink();
// add translations
if($translate=='all'){
$translations = Translatable::getTranslations();
if(is_object($translations)){
foreach($translations as $translation){
$urls[] = $translation->AbsoluteLink();
}
}
}
// cache the RSS feed if comments are enabled
if ($this->ProvideComments) {
$urls[] = Director::absoluteBaseURL() . "pagecomment/rss/" . $this->ID;
}
}
return $urls;
It doesn't deleting anything when I make a dev/buildcache