You are here

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

Connects to the server.

Overrides FileTransfer::connect

File

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

Class

SSH
The SSH connection class for the update module.

Namespace

Drupal\Core\FileTransfer

Code

public function connect() {
  $this->connection = @ssh2_connect($this->hostname, $this->port);
  if (!$this->connection) {
    throw new FileTransferException('SSH Connection failed to @host:@port', NULL, array(
      '@host' => $this->hostname,
      '@port' => $this->port,
    ));
  }
  if (!@ssh2_auth_password($this->connection, $this->username, $this->password)) {
    throw new FileTransferException('The supplied username/password combination was not accepted.');
  }
}