Skip to content

Instantly share code, notes, and snippets.

@cwage
Created August 26, 2010 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwage/552152 to your computer and use it in GitHub Desktop.
Save cwage/552152 to your computer and use it in GitHub Desktop.
// Clear the Cache
$cache_dir = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'prod';
$this->rmdirRecurse($cache_dir);
protected function rmdirRecurse($path)
{
$path = rtrim($path, '/') . '/';
$handle = opendir($path);
for (; false !== ($file = readdir($handle)) ;)
{
if ($file != "." && $file != ".." )
{
$fullpath = $path . $file;
if (is_dir($fullpath))
{
$this->rmdirRecurse($fullpath);
}
else
{
unlink($fullpath);
}
}
}
closedir($handle);
rmdir($path);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment