Logo Search packages:      
Sourcecode: aegir-provision version File versions  Download package

_provision_recursive_delete ( path  ) 

End of "defgroup provisionvalues". Remove files or directories, recursively

This was taken from imagecache.module, with slight modifications:

  • carry error codes along the way (returns TRUE only if all operations return TRUE)
  • remove any type of files encountered (not just links, files and dirs)
  • safety checking since we don't necessarly trust the removed files

Definition at line 136 of file provision.inc.

Referenced by drush_provision_drupal_provision_install_rollback().

                                            {
  $ret = 1;
  if (is_dir($path)) {
    $d = dir($path);
    while (($entry = $d->read()) !== FALSE) {
      if ($entry == '.' || $entry == '..') continue;
      $entry_path = $path .'/'. $entry;
      if (_provision_file_check_location($entry_path, $path)) {
        $ret = _provision_recursive_delete($entry_path);
      } 
      else {
        $ret = 0;
      }
    }

    $rm = provision_path('rmdir', $path, TRUE,
      dt('Deleting @path directory sucessful.', array('@path' => $path)),
      dt('Deleting @path directory failed.', array('@path' => $path)));

    $ret = $ret && $rm;
  }
  else {
    $rm = provision_path('unlink', $path, TRUE, NULL, 
      dt('Deleting @path file failed.', array('@path' => $path)));
    $ret = $ret && $rm;
  }
  return $ret;
}


Generated by  Doxygen 1.6.0   Back to index