public function SSH::isFile

Implements Drupal\Core\FileTransfer\FileTransfer::isFile().

Overrides FileTransfer::isFile

File

drupal/core/lib/Drupal/Core/FileTransfer/SSH.php, line 117
Definition of Drupal\Core\FileTransfer\SSH.

Class

SSH
The SSH connection class for the update module.

Namespace

Drupal\Core\FileTransfer

Code

public function isFile($path) {
  $file = escapeshellarg($path);
  $cmd = "[ -f {$file} ] && echo 'yes'";
  if ($output = @ssh2_exec($this->connection, $cmd)) {
    if ($output == 'yes') {
      return TRUE;
    }
    return FALSE;
  }
  else {
    throw new FileTransferException('Cannot check @path.', NULL, array(
      '@path' => $path,
    ));
  }
}