You are here

function ctools_stylizer_recursive_delete in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/stylizer.inc \ctools_stylizer_recursive_delete()

Recursively delete all files and folders in the specified filepath, then delete the containing folder.

Note that this only deletes visible files with write permission.

Parameters

string $path: A filepath relative to file_directory_path.

1 call to ctools_stylizer_recursive_delete()
ctools_stylizer_cleanup_style in includes/stylizer.inc
Clean up no longer used files.

File

includes/stylizer.inc, line 170
Create customized CSS and images from palettes created by user input.

Code

function ctools_stylizer_recursive_delete($path) {
  if (empty($path)) {
    return;
  }
  $listing = $path . '/*';
  foreach (glob($listing) as $file) {
    if (is_file($file) === TRUE) {
      @unlink($file);
    }
    elseif (is_dir($file) === TRUE) {
      ctools_stylizer_recursive_delete($file);
    }
  }
  @rmdir($path);
}