WordPress.org

Make WordPress Core

Changeset 30554


Ignore:
Timestamp:
11/24/2014 10:49:13 PM (5 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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-upgrader.php

    r30384 r30554  
    13731373
    13741374        if ( $parsed_args['clear_update_cache'] ) {
    1375             wp_clean_themes_cache( true );
    1376             wp_clean_plugins_cache( true );
    1377             delete_site_transient( 'update_core' );
     1375            _wp_clear_update_cache();
    13781376        }
    13791377
     
    22182216
    22192217            // Clear existing caches
    2220             wp_clean_plugins_cache();
    2221             wp_clean_themes_cache();
    2222             delete_site_transient( 'update_core' );
     2218            _wp_clear_update_cache();
    22232219
    22242220            wp_version_check();  // check for Core updates
  • 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.