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
This commit is contained in:
Dominik Schilling 2015-10-01 21:21:25 +00:00
parent 7c7eee01ef
commit 18413f3e81
2 changed files with 7 additions and 1 deletions

View File

@ -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'));

View File

@ -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.