X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/3f5685912e89eb3b0534acd85aa0946b1ca2bbe3..b609ea801799cbbd5f02d95e0dc547ab53a56f4c:/wp-admin/includes/class-wp-filesystem-ssh2.php diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index 0337658c..f5a64021 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -73,7 +73,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { else $this->options['hostname'] = $opt['hostname']; - if ( isset($opt['base']) && ! empty($opt['base']) ) + if ( ! empty($opt['base']) ) $this->wp_base = $opt['base']; // Check if the options provided are OK. @@ -160,14 +160,18 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { return file('ssh2.sftp://' . $this->sftp_link . '/' . $file); } - function put_contents($file, $contents, $type = '' ) { + function put_contents($file, $contents, $mode = false ) { $file = ltrim($file, '/'); - return false !== file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents); + $ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents); + + $this->chmod($file, $mode); + + return false !== $ret; } function cwd() { $cwd = $this->run_command('pwd'); - if( $cwd ) + if ( $cwd ) $cwd = trailingslashit($cwd); return $cwd; } @@ -235,10 +239,10 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { } function copy($source, $destination, $overwrite = false ) { - if( ! $overwrite && $this->exists($destination) ) + if ( ! $overwrite && $this->exists($destination) ) return false; $content = $this->get_contents($source); - if( false === $content) + if ( false === $content) return false; return $this->put_contents($destination, $content); }