You are here

public function SSH::isDirectory 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::isDirectory()

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

WARNING: This is untested. It is not currently used, but should do the trick.

Overrides FileTransfer::isDirectory

File

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

Class

SSH
The SSH connection class for the update module.

Namespace

Drupal\Core\FileTransfer

Code

public function isDirectory($path) {
  $directory = escapeshellarg($path);
  $cmd = "[ -d {$directory} ] && 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,
    ));
  }
}