Ticket #5586: 5586.3.diff
File 5586.3.diff, 6.1 KB (added by , 17 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-direct.php
13 13 function setDefaultPermissions($perm){ 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){ 23 23 return @file_get_contents($file); -
wp-admin/includes/class-wp-filesystem-ftpext.php
62 62 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 70 70 if ( ! $this->link ) { … … 72 72 return false; 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; 78 78 } … … 119 119 //If we get this far, somethings gone wrong, change to / and restart the process. 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 } 127 127 function get_contents($file,$type='',$resumepos=0){ … … 298 298 } 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; 304 305 } … … 325 326 return false; 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 ) 331 332 $this->chmod($path, $chmod); … … 337 338 } 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. 343 344 //$dir = $this->dirlist($path); -
wp-admin/includes/class-wp-filesystem-ftpsockets.php
122 122 return $this->find_base_dir('/',$echo); 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 } 130 130 -
wp-admin/includes/update.php
140 140 if ( $wp_filesystem->errors->get_error_code() ) 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 ]; 145 148 … … 148 151 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 154 157 if ( !$file ) 155 158 return new WP_Error('download_failed', __('Download failed.')); 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 161 164 if ( is_dir($working_dir) ) … … 175 178 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); 186 190 return new WP_Error('delete_failed', __('Could not remove the old plugin')); … … 188 192 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')); 194 198 }