library/Services/Library/Cache.php
private function removeTemporaryDirectory($dir, $rmBaseDir = false)
    {
        $itemsToIgnore = array('.', '..', '.htaccess');

        $files = array_diff(scandir($dir), $itemsToIgnore);
        foreach ($files as $file) {
            if (is_dir("$dir/$file")) {
                $this->removeTemporaryDirectory(
                    "$dir/$file",
                    $file == 'smarty' ? $rmBaseDir : true
                );
            } else {
                @unlink("$dir/$file");
            }
        }
        if ($rmBaseDir) {
            @rmdir($dir);
        }
    }
private function removeTemporaryDirectory($dir, $rmBaseDir = false)
    {
        $itemsToIgnore = array('.', '..', '.htaccess');

        $files = array_diff(scandir($dir), $itemsToIgnore);
        foreach ($files as $file) {
            if (is_dir("$dir/$file")) {
                $this->removeTemporaryDirectory(
                    "$dir/$file",
                    $file == 'smarty' ? $rmBaseDir : true
                );
            } else {
                @unlink("$dir/$file");
            }
        }
        if ($rmBaseDir) {
            @rmdir($dir);
        }
    }
private function removeTemporaryDirectory ( $ dir , $ rmBaseDir = false ) { $ itemsToIgnore = array ( '.' , '..' , '.htaccess' ) ; $ files = array_diff ( scandir ( $ dir ) , $ itemsToIgnore ) ; foreach ( $ files as $ file ) { if ( is_dir ( "$dir/$file" ) ) { $ this -> removeTemporaryDirectory ( "$dir/$file" , $ file == 'smarty' ? $ rmBaseDir : true ) ; } else { @ unlink ( "$dir/$file" ) ; } } if ( $ rmBaseDir ) { @ rmdir ( $ dir ) ; } }
Delete all files and dirs recursively

@param string $dir       Directory to delete
@param bool   $rmBaseDir Keep target directory
Delete all files and dirs recursively