public function FileTransferSSH::isFile

public FileTransferSSH::isFile($path)

Checks if a particular path is a file (not a directory).

Parameters

$path: The path to check

Return value

boolean

Overrides FileTransfer::isFile

File

includes/filetransfer/ssh.inc, line 81

Class

FileTransferSSH
The SSH connection class for the update module.

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

© 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::isFile/7.x