On this page
protected function FileTransfer::copyDirectoryJailed
protected FileTransfer::copyDirectoryJailed($source, $destination)
Copies a directory.
We need a separate method to make the $destination is in the jail.
Parameters
$source: The source path.
$destination: The destination path.
File
- includes/filetransfer/filetransfer.inc, line 212
Class
Code
protected function copyDirectoryJailed($source, $destination) {
if ($this->isDirectory($destination)) {
$destination = $destination . '/' . drupal_basename($source);
}
$this->createDirectory($destination);
foreach (new RecursiveIteratorIterator(new SkipDotsRecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) {
$relative_path = substr($filename, strlen($source));
if ($file->isDir()) {
$this->createDirectory($destination . $relative_path);
}
else {
$this->copyFile($file->getPathName(), $destination . $relative_path);
}
}
}
© 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!filetransfer.inc/function/FileTransfer::copyDirectoryJailed/7.x