You are here

function _mobile_codes_recursive_delete in Mobile Codes 6

Same name and namespace in other branches
  1. 5 mobile_codes.admin.inc \_mobile_codes_recursive_delete()
  2. 6.2 mobile_codes.module \_mobile_codes_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 _mobile_codes_recursive_delete()
mobile_codes_uninstall in ./mobile_codes.install
_mobile_codes_presets_flush in ./mobile_codes.admin.inc

File

./mobile_codes.admin.inc, line 308

Code

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