Make WordPress Core


Ignore:
Timestamp:
03/01/2008 09:20:23 PM (17 years ago)
Author:
ryan
Message:

Plugin updater updates. see #5586

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/update.php

    r7076 r7126  
    159159
    160160    // Clean up working directory
    161     $wp_filesystem->delete($working_dir, true);
     161    if ( is_dir($working_dir) )
     162        $wp_filesystem->delete($working_dir, true);
    162163
    163164    apply_filters('update_feedback', __("Unpacking the update"));
     
    175176    // Remove the existing plugin.
    176177    apply_filters('update_feedback', __("Removing the old version of the plugin"));
    177     $wp_filesystem->delete(ABSPATH . PLUGINDIR . "/$plugin");
    178178    $plugin_dir = dirname(ABSPATH . PLUGINDIR . "/$plugin");
    179 
    180179    // If plugin is in its own directory, recursively delete the directory.
    181180    if ( '.' != $plugin_dir && ABSPATH . PLUGINDIR != $plugin_dir )
    182         $wp_filesystem->delete($plugin_dir, true);
     181        $deleted = $wp_filesystem->delete($plugin_dir, true);
     182    else
     183        $deleted = $wp_filesystem->delete(ABSPATH . PLUGINDIR . "/$plugin");
     184    if ( !$deleted ) {
     185        $wp_filesystem->delete($working_dir, true);
     186        return new WP_Error('delete_failed', __('Could not remove the old plugin'));
     187    }
    183188
    184189    apply_filters('update_feedback', __("Installing the latest version"));
    185190    // Copy new version of plugin into place.
    186     copy_dir($working_dir, ABSPATH . PLUGINDIR);
     191    if ( !copy_dir($working_dir, ABSPATH . PLUGINDIR) ) {
     192        //$wp_filesystem->delete($working_dir, true);
     193        return new WP_Error('install_failed', __('Installation failed'));
     194    }
    187195
    188196    // Remove working directory
Note: See TracChangeset for help on using the changeset viewer.