function FileTransferSSH::chmodJailed

FileTransferSSH::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/ssh.inc, line 95

Class

FileTransferSSH
The SSH connection class for the update module.

Code

function chmodJailed($path, $mode, $recursive) {
  $cmd = sprintf("chmod %s%o %s", $recursive ? '-R ' : '', $mode, escapeshellarg($path));
  if (@!ssh2_exec($this->connection, $cmd)) {
    throw new FileTransferException('Cannot change permissions of @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!ssh.inc/function/FileTransferSSH::chmodJailed/7.x