On this page
protected function FileTransferLocal::removeDirectoryJailed
protected FileTransferLocal::removeDirectoryJailed($directory)
  Removes a directory.
Parameters
$directory: The directory to be removed.
Overrides FileTransfer::removeDirectoryJailed
File
- includes/filetransfer/local.inc, line 28
 
Class
- FileTransferLocal
 - The local connection class for copying files as the httpd user.
 
Code
protected function removeDirectoryJailed($directory) {
  if (!is_dir($directory)) {
    // Programmer error assertion, not something we expect users to see.
    throw new FileTransferException('removeDirectoryJailed() called with a path (%directory) that is not a directory.', NULL, array('%directory' => $directory));
  }
  foreach (new RecursiveIteratorIterator(new SkipDotsRecursiveDirectoryIterator($directory), RecursiveIteratorIterator::CHILD_FIRST) as $filename => $file) {
    if ($file->isDir()) {
      if (@!drupal_rmdir($filename)) {
        throw new FileTransferException('Cannot remove directory %directory.', NULL, array('%directory' => $filename));
      }
    }
    elseif ($file->isFile()) {
      if (@!drupal_unlink($filename)) {
        throw new FileTransferException('Cannot remove file %file.', NULL, array('%file' => $filename));
      }
    }
  }
  if (@!drupal_rmdir($directory)) {
    throw new FileTransferException('Cannot remove directory %directory.', NULL, array('%directory' => $directory));
  }
}
  © 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
 https://api.drupal.org/api/drupal/includes!filetransfer!local.inc/function/FileTransferLocal::removeDirectoryJailed/7.x