Ticket #17680: Proposed Upgrader Fix.diff
| File Proposed Upgrader Fix.diff, 4.2 KB (added by blurback, 2 years ago) |
|---|
-
wp-admin/includes/class-wp-upgrader.php
208 208 $destination = trailingslashit($destination) . trailingslashit(basename($source)); 209 209 } 210 210 211 $tempdir = untrailingslashit($remote_destination) . ".tmp-" . time() . "/"; 211 212 if ( $clear_destination ) { 213 //Try to rename original theme (also works as a backup) 214 $moved = @rename($remote_destination, $tempdir); 215 if ( ! $moved ) 216 return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); 217 212 218 //We're going to clear the destination if theres something there 213 219 $this->skin->feedback('remove_old'); 214 220 $removed = true; … … 259 265 return $res; 260 266 } 261 267 268 // Remove temporary backup 269 $removed = $wp_filesystem->delete($tempdir, true); 270 if( !$removed ) $this->skin->feedback("remove_tmp_failed"); 271 262 272 //Bombard the calling function will all the info which we've just used. 263 273 return $this->result; 264 274 } … … 373 383 $this->strings['deactivate_plugin'] = __('Deactivating the plugin…'); 374 384 $this->strings['remove_old'] = __('Removing the old version of the plugin…'); 375 385 $this->strings['remove_old_failed'] = __('Could not remove the old plugin.'); 386 $this->strings['remove_tmp_failed'] = __('Could not remove the temporary plugin directory.'); 376 387 $this->strings['process_failed'] = __('Plugin update failed.'); 377 388 $this->strings['process_success'] = __('Plugin updated successfully.'); 378 389 } … … 612 623 $this->strings['unpack_package'] = __('Unpacking the update…'); 613 624 $this->strings['remove_old'] = __('Removing the old version of the theme…'); 614 625 $this->strings['remove_old_failed'] = __('Could not remove the old theme.'); 626 $this->strings['remove_tmp_failed'] = __('Could not remove the temporary theme directory.'); 615 627 $this->strings['process_failed'] = __('Theme update failed.'); 616 628 $this->strings['process_success'] = __('Theme updated successfully.'); 617 629 }
