Changeset 17590
- Timestamp:
- 04/03/2011 11:54:07 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-upgrader.php
r17502 r17590 212 212 } 213 213 214 if ( $wp_filesystem->exists($remote_destination) ) { 215 if ( $clear_destination ) { 216 //We're going to clear the destination if theres something there 217 $this->skin->feedback('remove_old'); 214 if ( $clear_destination ) { 215 //We're going to clear the destination if theres something there 216 $this->skin->feedback('remove_old'); 217 $removed = true; 218 if ( $wp_filesystem->exists($remote_destination) ) 218 219 $removed = $wp_filesystem->delete($remote_destination, true); 219 $removed = apply_filters('upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra); 220 221 if ( is_wp_error($removed) ) 222 return $removed; 223 else if ( ! $removed ) 224 return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); 225 } else { 226 //If we're not clearing the destination folder and something exists there allready, Bail. 227 //But first check to see if there are actually any files in the folder. 228 $_files = $wp_filesystem->dirlist($remote_destination); 229 if ( ! empty($_files) ) { 230 $wp_filesystem->delete($remote_source, true); //Clear out the source files. 231 return new WP_Error('folder_exists', $this->strings['folder_exists'], $remote_destination ); 232 } 220 $removed = apply_filters('upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra); 221 222 if ( is_wp_error($removed) ) 223 return $removed; 224 else if ( ! $removed ) 225 return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); 226 } elseif ( $wp_filesystem->exists($remote_destination) ) { 227 //If we're not clearing the destination folder and something exists there allready, Bail. 228 //But first check to see if there are actually any files in the folder. 229 $_files = $wp_filesystem->dirlist($remote_destination); 230 if ( ! empty($_files) ) { 231 $wp_filesystem->delete($remote_source, true); //Clear out the source files. 232 return new WP_Error('folder_exists', $this->strings['folder_exists'], $remote_destination ); 233 233 } 234 234 } … … 567 567 function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) { 568 568 global $wp_filesystem; 569 569 var_dump("delete_old_plugin($removed, $local_destination, $remote_destination, $plugin)"); 570 570 if ( is_wp_error($removed) ) 571 571 return $removed; //Pass errors through. … … 577 577 $plugins_dir = $wp_filesystem->wp_plugins_dir(); 578 578 $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) ); 579 579 var_dump(compact('plugins_dir', 'this_plugin_dir'), array('exists'=> $wp_filesystem->exists($this_plugin_dir)) ); 580 580 if ( ! $wp_filesystem->exists($this_plugin_dir) ) //If its already vanished. 581 581 return $removed; … … 586 586 else 587 587 $deleted = $wp_filesystem->delete($plugins_dir . $plugin); 588 588 var_dump($deleted); 589 589 if ( ! $deleted ) 590 590 return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); 591 591 592 return $removed;592 return true; 593 593 } 594 594 }
Note: See TracChangeset
for help on using the changeset viewer.