/** * http://de3.php.net/manual/de/function.rmdir.php * ornthalas at NOSPAM dot gmail dot com * * @param string $filepath * @return unknown */ function rmRecurse($filepath) { if (is_dir($filepath) && !is_link($filepath)) { if ($dh = opendir($filepath)) { while (($sf = readdir($dh)) !== false) { if ($sf == '.' || $sf == '..') { continue; } if (!rmRecurse($filepath . '/' . $sf)) { throw new Exception($filepath . '/' . $sf . ' could not be deleted.'); } } closedir($dh); } return rmdir($filepath); } return unlink($filepath); }
function clearCache() { global $shop; $cacheDir = $shop . 'var/cache/'; rmRecurse($cacheDir); }