Changeset 8880 for trunk/wp-admin/includes/class-wp-filesystem-ssh2.php
- Timestamp:
- 09/13/2008 06:06:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-filesystem-ssh2.php
r8865 r8880 64 64 $this->errors = new WP_Error(); 65 65 66 //Check if possible to use ftpfunctions.66 //Check if possible to use ssh2 functions. 67 67 if ( ! extension_loaded('ssh2') ) { 68 68 $this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available')); … … 90 90 $this->options['username'] = $opt['username']; 91 91 92 if ( ( !empty ($opt['public_key']) ) && ( !empty ($opt['private_key']) )) {92 if ( ( !empty ($opt['public_key']) ) && ( !empty ($opt['private_key']) ) ) { 93 93 $this->options['public_key'] = $opt['public_key']; 94 94 $this->options['private_key'] = $opt['private_key']; … … 100 100 101 101 102 if ( empty ($opt['password']) ) 102 if ( empty ($opt['password']) ) { 103 103 if ( !$this->keys ) // password can be blank if we are using keys 104 104 $this->errors->add('empty_password', __('SSH2 password is required')); 105 else105 } else { 106 106 $this->options['password'] = $opt['password']; 107 } 107 108 108 109 } … … 110 111 function connect() { 111 112 $this->debug("connect();"); 112 if ( ! $this->keys ) 113 $this->link = @ssh2_connect($this->options['hostname'], $this->options['port']); 114 else 115 $this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']); 113 114 if ( ! $this->keys ) { 115 $this->link = @ssh2_connect($this->options['hostname'], $this->options['port']); 116 } else { 117 $this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']); 118 } 116 119 117 120 if ( ! $this->link ) { … … 203 206 204 207 function put_contents($file, $contents, $type = '' ) { 205 $this->debug("put_contents( );");208 $this->debug("put_contents($file);"); 206 209 $tempfile = wp_tempnam( $file ); 207 210 $temp = fopen($tempfile, 'w'); … … 327 330 $this->debug("is_dir();"); 328 331 //DO NOT RELY ON dirlist()! 329 $list = $this->parselisting($this->run_command($this->link, sprintf('ls -lad %s', rtrim($path, '/'))));332 $list = $this->parselisting($this->run_command($this->link, sprintf('ls -lad %s', untrailingslashit($path)))); 330 333 if ( ! $list ) 331 334 return false; … … 360 363 function mkdir($path, $chmod = null, $chown = false, $chgrp = false) { 361 364 $this->debug("mkdir();"); 362 $path = trim($path, '/');365 $path = untrailingslashit($path); 363 366 if( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) ) 364 367 return false;
Note: See TracChangeset
for help on using the changeset viewer.