From 18413f3e81891c0dfd166bc23544eaff5d36d4fb Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Thu, 1 Oct 2015 21:21:25 +0000 Subject: [PATCH] Upgrader: Clear plugin/theme caches directly after a plugin/theme has been installed. `wp_update_plugins()` and `wp_update_themes()` are both hooked into `upgrader_process_complete` with priority 10. But at this stage the caches in `get_plugins()`, `search_theme_directories()`, and `wp_get_themes()` aren't refreshed yet so both functions couldn't fetch any translations for the new plugin/theme. To reset the caches `wp_clean_themes_cache()` and `wp_clean_plugins_cache()` are now hooked into `upgrader_process_complete` with priority 9. Fixes #34029. Built from https://develop.svn.wordpress.org/trunk@34751 git-svn-id: http://core.svn.wordpress.org/trunk@34716 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 6 ++++++ wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 89f966cd60..ff25249a92 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -844,6 +844,8 @@ class Plugin_Upgrader extends WP_Upgrader { $this->install_strings(); add_filter('upgrader_source_selection', array($this, 'check_package') ); + // Clear cache so wp_update_plugins() knows about the new plugin. + add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 ); $this->run( array( 'package' => $package, @@ -856,6 +858,7 @@ class Plugin_Upgrader extends WP_Upgrader { ) ) ); + remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 ); remove_filter('upgrader_source_selection', array($this, 'check_package') ); if ( ! $this->result || is_wp_error($this->result) ) @@ -1408,6 +1411,8 @@ 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 ); $this->run( array( 'package' => $package, @@ -1420,6 +1425,7 @@ class Theme_Upgrader extends WP_Upgrader { ), ) ); + remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); remove_filter('upgrader_source_selection', array($this, 'check_package') ); remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter')); diff --git a/wp-includes/version.php b/wp-includes/version.php index d220e42195..9950a76331 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34750'; +$wp_version = '4.4-alpha-34751'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.