wp/wp-admin/includes/class-wp-filesystem-ssh2.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    24  * Add in your PHP.ini file: extension=ssh2.so
    24  * Add in your PHP.ini file: extension=ssh2.so
    25  *
    25  *
    26  * Restart Apache!
    26  * Restart Apache!
    27  * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
    27  * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
    28  *
    28  *
    29  * Note: As of WordPress 2.8, this utilises the PHP5+ function `stream_get_contents()`.
    29  * Note: As of WordPress 2.8, this utilizes the PHP5+ function `stream_get_contents()`.
    30  *
    30  *
    31  * @since 2.7.0
    31  * @since 2.7.0
    32  *
    32  *
    33  * @package WordPress
    33  * @package WordPress
    34  * @subpackage Filesystem
    34  * @subpackage Filesystem
    86 		// Check if the options provided are OK.
    86 		// Check if the options provided are OK.
    87 		if ( ! empty( $opt['public_key'] ) && ! empty( $opt['private_key'] ) ) {
    87 		if ( ! empty( $opt['public_key'] ) && ! empty( $opt['private_key'] ) ) {
    88 			$this->options['public_key']  = $opt['public_key'];
    88 			$this->options['public_key']  = $opt['public_key'];
    89 			$this->options['private_key'] = $opt['private_key'];
    89 			$this->options['private_key'] = $opt['private_key'];
    90 
    90 
    91 			$this->options['hostkey'] = array( 'hostkey' => 'ssh-rsa' );
    91 			$this->options['hostkey'] = array( 'hostkey' => 'ssh-rsa,ssh-ed25519' );
    92 
    92 
    93 			$this->keys = true;
    93 			$this->keys = true;
    94 		} elseif ( empty( $opt['username'] ) ) {
    94 		} elseif ( empty( $opt['username'] ) ) {
    95 			$this->errors->add( 'empty_username', __( 'SSH2 username is required' ) );
    95 			$this->errors->add( 'empty_username', __( 'SSH2 username is required' ) );
    96 		}
    96 		}
   736 	 * @return array|false {
   736 	 * @return array|false {
   737 	 *     Array of files. False if unable to list directory contents.
   737 	 *     Array of files. False if unable to list directory contents.
   738 	 *
   738 	 *
   739 	 *     @type string $name        Name of the file or directory.
   739 	 *     @type string $name        Name of the file or directory.
   740 	 *     @type string $perms       *nix representation of permissions.
   740 	 *     @type string $perms       *nix representation of permissions.
   741 	 *     @type int    $permsn      Octal representation of permissions.
   741 	 *     @type string $permsn      Octal representation of permissions.
   742 	 *     @type string $owner       Owner name or ID.
   742 	 *     @type string $owner       Owner name or ID.
   743 	 *     @type int    $size        Size of file in bytes.
   743 	 *     @type int    $size        Size of file in bytes.
   744 	 *     @type int    $lastmodunix Last modified unix timestamp.
   744 	 *     @type int    $lastmodunix Last modified unix timestamp.
   745 	 *     @type mixed  $lastmod     Last modified month (3 letter) and day (without leading 0).
   745 	 *     @type mixed  $lastmod     Last modified month (3 letter) and day (without leading 0).
   746 	 *     @type int    $time        Last modified time.
   746 	 *     @type int    $time        Last modified time.
   747 	 *     @type string $type        Type of resource. 'f' for file, 'd' for directory.
   747 	 *     @type string $type        Type of resource. 'f' for file, 'd' for directory.
   748 	 *     @type mixed  $files       If a directory and $recursive is true, contains another array of files.
   748 	 *     @type mixed  $files       If a directory and `$recursive` is true, contains another array of files.
   749 	 * }
   749 	 * }
   750 	 */
   750 	 */
   751 	public function dirlist( $path, $include_hidden = true, $recursive = false ) {
   751 	public function dirlist( $path, $include_hidden = true, $recursive = false ) {
   752 		if ( $this->is_file( $path ) ) {
   752 		if ( $this->is_file( $path ) ) {
   753 			$limit_file = basename( $path );
   753 			$limit_file = basename( $path );