You are here

function SSH::chmodJailed in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/FileTransfer/SSH.php \Drupal\Core\FileTransfer\SSH::chmodJailed()

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

Parameters

string $path: Path to change permissions of.

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

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

Overrides ChmodInterface::chmodJailed

See also

http://php.net/chmod

File

core/lib/Drupal/Core/FileTransfer/SSH.php, line 135
Contains \Drupal\Core\FileTransfer\SSH.

Class

SSH
The SSH connection class for the update module.

Namespace

Drupal\Core\FileTransfer

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,
    ));
  }
}