public function FileTransferLocal::chmodJailed

public FileTransferLocal::chmodJailed($path, $mode, $recursive)

Changes the permissions of the file / directory specified in $path

Parameters

string $path: Path to change permissions of.

long $mode: The new file permission mode to be passed to chmod().

boolean $recursive: Pass TRUE to recursively chmod the entire directory specified in $path.

Overrides FileTransferChmodInterface::chmodJailed

File

includes/filetransfer/local.inc, line 64

Class

FileTransferLocal
The local connection class for copying files as the httpd user.

Code

public function chmodJailed($path, $mode, $recursive) {
  if ($recursive && is_dir($path)) {
    foreach (new RecursiveIteratorIterator(new SkipDotsRecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) {
      if (@!chmod($filename, $mode)) {
        throw new FileTransferException('Cannot chmod %path.', NULL, array('%path' => $filename));
      }
    }
  }
  elseif (@!chmod($path, $mode)) {
    throw new FileTransferException('Cannot chmod %path.', NULL, array('%path' => $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!local.inc/function/FileTransferLocal::chmodJailed/7.x