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.

git-svn-id: https://develop.svn.wordpress.org/trunk@34751 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2015-10-01 21:20:09 +00:00
parent a8b5a8ec63
commit 00762410b0
1 changed files with 6 additions and 0 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'));