You are here

function _textimage_recursive_delete in Textimage 6.2

Same name and namespace in other branches
  1. 5.2 textimage_admin.inc \_textimage_recursive_delete()
  2. 5 textimage.module \_textimage_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: An absolute filepath (relative to the filesystem) to delete

2 calls to _textimage_recursive_delete()
textimage_uninstall in ./textimage.install
Implementation of hook_uninstall().
_textimage_preset_flush in ./textimage_admin.inc
flush cached media for a preset.

File

./textimage_admin.inc, line 722

Code

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