]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-theme-upgrader.php
WordPress 4.7
[autoinstalls/wordpress.git] / wp-admin / includes / class-theme-upgrader.php
index 76129e34099f631a7e510cc6f438f59f8b439cf9..b2571ee7f48e86d4ab63b577469cb6c009c72fd3 100644 (file)
@@ -201,8 +201,10 @@ class Theme_Upgrader extends WP_Upgrader {
 
                add_filter('upgrader_source_selection', array($this, 'check_package') );
                add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
-               // Clear cache so wp_update_themes() knows about the new theme.
-               add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+               if ( $parsed_args['clear_update_cache'] ) {
+                       // Clear cache so wp_update_themes() knows about the new theme.
+                       add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+               }
 
                $this->run( array(
                        'package' => $package,
@@ -269,8 +271,10 @@ class Theme_Upgrader extends WP_Upgrader {
                add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
                add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
                add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
-               // Clear cache so wp_update_themes() knows about the new theme.
-               add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+               if ( $parsed_args['clear_update_cache'] ) {
+                       // Clear cache so wp_update_themes() knows about the new theme.
+                       add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+               }
 
                $this->run( array(
                        'package' => $r['package'],
@@ -329,8 +333,6 @@ class Theme_Upgrader extends WP_Upgrader {
                add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
                add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
                add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
-               // Clear cache so wp_update_themes() knows about the new theme.
-               add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
 
                $this->skin->header();
 
@@ -394,6 +396,9 @@ class Theme_Upgrader extends WP_Upgrader {
 
                $this->maintenance_mode(false);
 
+               // Refresh the Theme Update information
+               wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
+
                /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
                do_action( 'upgrader_process_complete', $this, array(
                        'action' => 'update',
@@ -407,14 +412,10 @@ class Theme_Upgrader extends WP_Upgrader {
                $this->skin->footer();
 
                // Cleanup our hooks, in case something else does a upgrade on this connection.
-               remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
                remove_filter('upgrader_pre_install', array($this, 'current_before'));
                remove_filter('upgrader_post_install', array($this, 'current_after'));
                remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
 
-               // Refresh the Theme Update information
-               wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
-
                return $results;
        }