cache clean works fine with file adapter. no need to hassle around with file handling

This commit is contained in:
HB9HIL
2026-02-02 16:28:44 +01:00
parent a2189d6952
commit fbda15ff5b

View File

@@ -266,28 +266,6 @@ class Debug_model extends CI_Model
'key_prefix' => $cache_key_prefix
]);
if ($cache_adapter === 'file') {
$cache_path = $this->config->item('cache_path') ?: 'application/cache';
$cache_path = realpath(APPPATH . '../') . '/' . $cache_path;
if (!is_dir($cache_path)) {
return false;
}
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($cache_path, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($files as $file) {
if ($file->isFile() && !in_array($file->getFilename(), ['index.html', '.htaccess'])) {
@unlink($file->getRealPath());
}
}
return true;
}
if (method_exists($this->cache, 'clean')) {
return $this->cache->clean();
}