function SSH::chmodJailed

Same name in other branches
  1. 9 core/lib/Drupal/Core/FileTransfer/SSH.php \Drupal\Core\FileTransfer\SSH::chmodJailed()
  2. 10 core/lib/Drupal/Core/FileTransfer/SSH.php \Drupal\Core\FileTransfer\SSH::chmodJailed()
  3. 11.x core/lib/Drupal/Core/FileTransfer/SSH.php \Drupal\Core\FileTransfer\SSH::chmodJailed()

Overrides ChmodInterface::chmodJailed

File

core/lib/Drupal/Core/FileTransfer/SSH.php, line 130

Class

SSH
The SSH connection class for the update module.

Namespace

Drupal\Core\FileTransfer

Code

public 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, [
            '@path' => $path,
        ]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.