Clear update caches when site language is changed.

The update screen has a re-install button which could show the wrong language locale after the site language was changed. That's because the update data is cached. 
Introduce `_wp_clear_update_cache()` as a helper function to clean up the update cache.

props SergeyBiryukov, ocean90.
fixes #30369.
Built from https://develop.svn.wordpress.org/trunk@30554


git-svn-id: http://core.svn.wordpress.org/trunk@30543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2014-11-24 22:50:22 +00:00
parent 6b51f14c6f
commit e39c43ad6c
3 changed files with 18 additions and 8 deletions

View File

@ -1372,9 +1372,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
if ( $parsed_args['clear_update_cache'] ) {
wp_clean_themes_cache( true );
wp_clean_plugins_cache( true );
delete_site_transient( 'update_core' );
_wp_clear_update_cache();
}
return $results;
@ -2217,9 +2215,7 @@ class WP_Automatic_Updater {
}
// Clear existing caches
wp_clean_plugins_cache();
wp_clean_themes_cache();
delete_site_transient( 'update_core' );
_wp_clear_update_cache();
wp_version_check(); // check for Core updates
wp_update_themes(); // Check for Theme updates

View File

@ -648,8 +648,20 @@ function wp_schedule_update_checks() {
}
}
if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
/**
* Clear existing update caches for plugins, themes, and core.
*
* @since 4.1.0
*/
function _wp_clear_update_cache() {
wp_clean_plugins_cache();
wp_clean_themes_cache();
delete_site_transient( 'update_core' );
}
if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
return;
}
add_action( 'admin_init', '_maybe_update_core' );
add_action( 'wp_version_check', 'wp_version_check' );
@ -669,6 +681,8 @@ add_action( 'admin_init', '_maybe_update_themes' );
add_action( 'wp_update_themes', 'wp_update_themes' );
add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
add_action( 'update_option_WPLANG', '_wp_clear_update_cache' , 10, 0 );
add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
add_action('init', 'wp_schedule_update_checks');

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-beta2-30553';
$wp_version = '4.1-beta2-30554';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.