Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SSH.php

function SSH::isFile

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal