Make WordPress Core


Ignore:
Timestamp:
11/24/2014 10:49:13 PM (10 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/update.php

    r30384 r30554  
    649649}
    650650
    651 if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
     651/**
     652 * Clear existing update caches for plugins, themes, and core.
     653 *
     654 * @since 4.1.0
     655 */
     656function _wp_clear_update_cache() {
     657    wp_clean_plugins_cache();
     658    wp_clean_themes_cache();
     659    delete_site_transient( 'update_core' );
     660}
     661
     662if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
    652663    return;
     664}
    653665
    654666add_action( 'admin_init', '_maybe_update_core' );
     
    670682add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
    671683
     684add_action( 'update_option_WPLANG', '_wp_clear_update_cache' , 10, 0 );
     685
    672686add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
    673687
Note: See TracChangeset for help on using the changeset viewer.