protected function clearDir($dir)
    {
        $iterator = new \DirectoryIterator($dir);
        foreach ($iterator as $file) {

            if ($file->isDir() && !$file->isDot() && !preg_match("~\.~", $file)) {
                $this->clearDir($file->getPathname());
                if (!\rmdir($file->getPathname())) {
                    return false;
                }
            } elseif ($file->isFile()) {
                if (!\unlink($file->getPathname())) {
                    return false;
                }
            }
        }

        return true;
    }
protected function clearDir($dir)
    {
        $iterator = new \DirectoryIterator($dir);
        foreach ($iterator as $file) {

            if ($file->isDir() && !$file->isDot() && !preg_match("~\.~", $file)) {
                $this->clearDir($file->getPathname());
                if (!\rmdir($file->getPathname())) {
                    return false;
                }
            } elseif ($file->isFile()) {
                if (!\unlink($file->getPathname())) {
                    return false;
                }
            }
        }

        return true;
    }
protected function clearDir ( $ dir ) { $ iterator = new \ DirectoryIterator ( $ dir ) ; foreach ( $ iterator as $ file ) { if ( $ file -> isDir ( ) && ! $ file -> isDot ( ) && ! preg_match ( "~\.~" , $ file ) ) { $ this -> clearDir ( $ file -> getPathname ( ) ) ; if ( ! \ rmdir ( $ file -> getPathname ( ) ) ) { return false ; } } elseif ( $ file -> isFile ( ) ) { if ( ! \ unlink ( $ file -> getPathname ( ) ) ) { return false ; } } } return true ; }
Clears out the contents of a cache directory
@param $dir
@return boolean
Clears out the contents of a cache directory