Make WordPress Core


Ignore:
Timestamp:
11/13/2016 09:52:49 AM (10 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.