Changeset 7155
- Timestamp:
- 03/04/08 17:10:17 (4 months ago)
- Files:
-
- trunk/wp-admin/includes/class-wp-filesystem-direct.php (modified) (1 diff)
- trunk/wp-admin/includes/class-wp-filesystem-ftpext.php (modified) (6 diffs)
- trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php (modified) (1 diff)
- trunk/wp-admin/includes/update.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/includes/class-wp-filesystem-direct.php
r7130 r7155 14 14 $this->permission = $perm; 15 15 } 16 function find_base_dir($base = '.' ){16 function find_base_dir($base = '.', $echo = false){ 17 17 return str_replace('\\','/',ABSPATH); 18 18 } 19 function get_base_dir($base = '.' ){20 return str_replace('\\','/',ABSPATH);19 function get_base_dir($base = '.', $echo = false){ 20 return find_base_dir($base, $echo); 21 21 } 22 22 function get_contents($file){ trunk/wp-admin/includes/class-wp-filesystem-ftpext.php
r7130 r7155 63 63 function connect(){ 64 64 if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') ) { 65 $this->link = ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout);65 $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout); 66 66 } else { 67 $this->link = ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout);67 $this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout); 68 68 } 69 69 … … 73 73 } 74 74 75 if ( ! ftp_login($this->link,$this->options['username'], $this->options['password']) ) {75 if ( ! @ftp_login($this->link,$this->options['username'], $this->options['password']) ) { 76 76 $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username'])); 77 77 return false; … … 120 120 return $this->find_base_dir('/',$echo); 121 121 } 122 function get_base_dir($base = '.' ){122 function get_base_dir($base = '.', $echo=false){ 123 123 if( empty($this->wp_base) ) 124 $this->wp_base = $this->find_base_dir($base );124 $this->wp_base = $this->find_base_dir($base,$echo); 125 125 return $this->wp_base; 126 126 } … … 299 299 function is_dir($path){ 300 300 $cwd = $this->cwd(); 301 if ( @ftp_chdir($this->link, $path) ) { 301 @ftp_chdir($this->link, $path); 302 if ( $this->cwd() != $cwd ) { 302 303 @ftp_chdir($this->link, $cwd); 303 304 return true; … … 326 327 } 327 328 function mkdir($path,$chmod=false,$chown=false,$chgrp=false){ 328 if( ! ftp_mkdir($this->link, $path) )329 if( !@ftp_mkdir($this->link, $path) ) 329 330 return false; 330 331 if( $chmod ) … … 338 339 function rmdir($path,$recursive=false){ 339 340 if( ! $recursive ) 340 return ftp_rmdir($this->link, $file);341 return @ftp_rmdir($this->link, $file); 341 342 342 343 //TODO: Recursive Directory delete, Have to delete files from the folder first. trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php
r7130 r7155 123 123 } 124 124 125 function get_base_dir($base = '.' ){125 function get_base_dir($base = '.', $echo = false){ 126 126 if( empty($this->wp_base) ) 127 $this->wp_base = $this->find_base_dir($base );127 $this->wp_base = $this->find_base_dir($base, $echo); 128 128 return $this->wp_base; 129 129 } trunk/wp-admin/includes/update.php
r7130 r7155 141 141 return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors); 142 142 143 //Get the Base folder 144 $base = $wp_filesystem->get_base_dir(); 145 143 146 // Get the URL to the zip file 144 147 $r = $current->response[ $plugin ]; … … 149 152 // Download the package 150 153 $package = $r->package; 151 apply_filters('update_feedback', __("Downloading update from $package"));154 apply_filters('update_feedback', sprintf(__("Downloading update from %s"), $package)); 152 155 $file = download_url($package); 153 156 … … 156 159 157 160 $name = basename($plugin, '.php'); 158 $working_dir = ABSPATH. 'wp-content/upgrade/' . $name;161 $working_dir = $base . 'wp-content/upgrade/' . $name; 159 162 160 163 // Clean up working directory … … 176 179 // Remove the existing plugin. 177 180 apply_filters('update_feedback', __("Removing the old version of the plugin")); 178 $plugin_dir = dirname(ABSPATH . PLUGINDIR . "/$plugin"); 181 $plugin_dir = dirname($base . PLUGINDIR . "/$plugin"); 182 $plugin_dir = trailingslashit($plugin_dir); 179 183 // If plugin is in its own directory, recursively delete the directory. 180 if ( '.' != $plugin_dir && ABSPATH. PLUGINDIR != $plugin_dir )184 if ( '.' != $plugin_dir && $base . PLUGINDIR != $plugin_dir ) 181 185 $deleted = $wp_filesystem->delete($plugin_dir, true); 182 186 else 183 $deleted = $wp_filesystem->delete( ABSPATH. PLUGINDIR . "/$plugin");187 $deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin"); 184 188 if ( !$deleted ) { 185 189 $wp_filesystem->delete($working_dir, true); … … 189 193 apply_filters('update_feedback', __("Installing the latest version")); 190 194 // Copy new version of plugin into place. 191 if ( !copy_dir($working_dir, ABSPATH. PLUGINDIR) ) {195 if ( !copy_dir($working_dir, $base . PLUGINDIR) ) { 192 196 //$wp_filesystem->delete($working_dir, true); 193 197 return new WP_Error('install_failed', __('Installation failed'));
