WordPress.org

Make WordPress Core

Ticket #5586: 5586.8.diff

File 5586.8.diff, 690 bytes (added by DD32, 13 years ago)

Critical: updater deletes entire plugins folder if upgrade a plugin which exists as a single file.

  • wp-admin/includes/update.php

     
    184184        $plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
    185185        $plugin_dir = trailingslashit($plugin_dir);
    186186        // If plugin is in its own directory, recursively delete the directory.
    187         if ( '.' != $plugin_dir && $base . PLUGINDIR != $plugin_dir )
     187        if( ! in_array( $plugin_dir, array('.', trailingslashit($base . PLUGINDIR) ) ) )
    188188                $deleted = $wp_filesystem->delete($plugin_dir, true);
    189189        else
    190190                $deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");