WordPress.org

Make WordPress Core

Changeset 39211


Ignore:
Timestamp:
11/13/2016 09:52:49 AM (4 years ago)
Author:
dd32
Message:

Updates: Allow background updates to update multiple plugins/themes in the same request.
Due to the clear_update_cache parameter not being respected, update caches were being cleared incorrectly which prevented multiple plugins to be updated at the same time in background updates - failing with a fs_unavailable error message.

Fixes #38024

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-plugin-upgrader.php

    r37432 r39211  
    102102
    103103        add_filter('upgrader_source_selection', array($this, 'check_package') );
    104         // Clear cache so wp_update_plugins() knows about the new plugin.
    105         add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
     104        if ( $parsed_args['clear_update_cache'] ) {
     105            // Clear cache so wp_update_plugins() knows about the new plugin.
     106            add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
     107        }
    106108
    107109        $this->run( array(
     
    169171        add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4);
    170172        //'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
    171         // Clear cache so wp_update_plugins() knows about the new plugin.
    172         add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
     173        if ( $parsed_args['clear_update_cache'] ) {
     174            // Clear cache so wp_update_plugins() knows about the new plugin.
     175            add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
     176        }
    173177
    174178        $this->run( array(
     
    228232
    229233        add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4);
    230         add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
    231234
    232235        $this->skin->header();
     
    295298        $this->maintenance_mode(false);
    296299
     300        // Force refresh of plugin update information.
     301        wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
     302
    297303        /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
    298304        do_action( 'upgrader_process_complete', $this, array(
     
    308314
    309315        // Cleanup our hooks, in case something else does a upgrade on this connection.
    310         remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 );
    311316        remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'));
    312 
    313         // Force refresh of plugin update information.
    314         wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
    315317
    316318        return $results;
  • trunk/src/wp-admin/includes/class-theme-upgrader.php

    r37432 r39211  
    202202        add_filter('upgrader_source_selection', array($this, 'check_package') );
    203203        add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
    204         // Clear cache so wp_update_themes() knows about the new theme.
    205         add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
     204        if ( $parsed_args['clear_update_cache'] ) {
     205            // Clear cache so wp_update_themes() knows about the new theme.
     206            add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
     207        }
    206208
    207209        $this->run( array(
     
    270272        add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
    271273        add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
    272         // Clear cache so wp_update_themes() knows about the new theme.
    273         add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
     274        if ( $parsed_args['clear_update_cache'] ) {
     275            // Clear cache so wp_update_themes() knows about the new theme.
     276            add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
     277        }
    274278
    275279        $this->run( array(
     
    330334        add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
    331335        add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
    332         // Clear cache so wp_update_themes() knows about the new theme.
    333         add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
    334336
    335337        $this->skin->header();
     
    395397        $this->maintenance_mode(false);
    396398
     399        // Refresh the Theme Update information
     400        wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
     401
    397402        /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
    398403        do_action( 'upgrader_process_complete', $this, array(
     
    408413
    409414        // Cleanup our hooks, in case something else does a upgrade on this connection.
    410         remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
    411415        remove_filter('upgrader_pre_install', array($this, 'current_before'));
    412416        remove_filter('upgrader_post_install', array($this, 'current_after'));
    413417        remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
    414 
    415         // Refresh the Theme Update information
    416         wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
    417418
    418419        return $results;
Note: See TracChangeset for help on using the changeset viewer.