function mgRmDir($inpath) { str_replace("//", "/", $inpath); $dir = explode("/", $inpath); foreach ($dir as $key => $val) { $path = implode("/", $dir); if (false == mgUnLink($path)) { return false; } if (NULL != ($dirs = mgGetDir($path))) { foreach ($dirs as $inkey => $inval) { if (mgRmDir($path . "/" . $inval) == false) { return false; } } } if (false == @rmdir($path)) { return false; } if ($inpath != $path) { array_pop($dir); } else { break; } } return true; }
protected function deleteCache($cache) { if (is_file(__CACHE__ . '/' . $cache . '/' . $cache . '.php')) { unlink(__CACHE__ . '/' . $cache . '/' . $cache . '.php'); return true; } else { if (is_dir(__CACHE__ . '/' . $cache)) { mgRmDir(__CACHE__ . '/' . $cache); return true; } else { return false; } } }