You are here

function _hacked_remove_directory in Hacked! 7.3

Remove directory with files.

1 call to _hacked_remove_directory()
_hacked_restore_project in ./hacked.helpers.inc
Restore core, module or theme.

File

./hacked.helpers.inc, line 31
Contain list of helpers for the module.

Code

function _hacked_remove_directory($dir) {
  if (!is_dir($dir)) {
    watchdog('hacked', $dir . ' must be a directory');
    return FALSE;
  }
  if (substr($dir, strlen($dir) - 1, 1) != '/') {
    $dir .= '/';
  }
  $files = glob($dir . '*', GLOB_MARK);
  foreach ($files as $file) {
    if (is_dir($file)) {
      if (!_hacked_remove_directory($file)) {
        watchdog('hacked', 'What is wrong');
        return FALSE;
      }
    }
    else {
      unlink($file);
    }
  }
  rmdir($dir);
  return TRUE;
}