public function SSH::isFile
public SSH::isFile($path)
Checks if a particular path is a file (not a directory).
Parameters
string $path: The path to check.
Return value
bool TRUE if the specified path is a file, FALSE otherwise.
Overrides FileTransfer::isFile
File
- core/lib/Drupal/Core/FileTransfer/SSH.php, line 113
Class
- SSH
- The SSH connection class for the update module.
Namespace
Drupal\Core\FileTransferCode
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/core!lib!Drupal!Core!FileTransfer!SSH.php/function/SSH::isFile/8.1.x