wp-admin/includes/class-wp-filesystem-ssh2.php:47WordPress Filesystem Class for implementing SSH2
$linkresource|falsepublic$sftp_linkresource|falsepublic$keysboolpublic$optionsarraypublicclass WP_Filesystem_SSH2 extends WP_Filesystem_Base { /** * @since 2.7.0 * @var resource|false */ public $link = false; /** * @since 2.7.0 * @var resource|false */ public $sftp_link; /** * @since 2.7.0 * @var bool */ public $keys = false; /** * @since 7.1.0 * @var array * @phpstan-var Options */ public $options; /** * Constructor. * * @since 2.7.0 * * @param array $opt { * Array of connection options. * * @type string $hostname Required. SSH server hostname. * @type string $username Required. SSH username. * @type int $port Optional. SSH server port. Default 22. * @type string $password Optional. SSH password. May be empty when using keys. * @type string $public_key Optional. Path to public key file for publickey authentication. * @type string $private_key Optional. Path to private key file for publickey authentication. * } * @phpstan-param array{ * hostname: non-empty-string, * username: non-empty-string, * port?: non-negative-int, * password?: string, * public_key?: non-empty-string, * private_key?: non-empty-string, * }|null $opt */ public function __construct( $opt = null ) { $this->method = 'ssh2'; $this->errors = new WP_Error(); $this->options = array( 'port' => 22, 'hostname' => '', 'username' => '', 'password' => null, ); // Check if possible to use ssh2 functions. if ( ! extension_loaded( 'ssh2' ) ) { $this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) ); return; } if ( ! is_array( $opt ) ) { $opt = array(); } // Set defaults: if ( ! empty( $opt['port'] ) ) { $this->options['port'] = $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'SSH2 hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname'];Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-admin/includes/class-wp-filesystem-ssh2.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.