static function FileTransferSSH::factory

static FileTransferSSH::factory($jail, $settings)

Classes that extend this class must override the factory() static method.

Parameters

string $jail: The full path where all file operations performed by this object will be restricted to. This prevents the FileTransfer classes from being able to touch other parts of the filesystem.

array $settings: An array of connection settings for the FileTransfer subclass. If the getSettingsForm() method uses any nested settings, the same structure will be assumed here.

Return value

object New instance of the appropriate FileTransfer subclass.

Overrides FileTransfer::factory

File

includes/filetransfer/ssh.inc, line 26

Class

FileTransferSSH
The SSH connection class for the update module.

Code

static function factory($jail, $settings) {
  $username = empty($settings['username']) ? '' : $settings['username'];
  $password = empty($settings['password']) ? '' : $settings['password'];
  $hostname = empty($settings['advanced']['hostname']) ? 'localhost' : $settings['advanced']['hostname'];
  $port = empty($settings['advanced']['port']) ? 22 : $settings['advanced']['port'];
  return new FileTransferSSH($jail, $username, $password, $hostname, $port);
}

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