Make WordPress Core

Changeset 34751


Ignore:
Timestamp:
10/01/2015 09:20:09 PM (9 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

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

    r34748 r34751  
    845845
    846846        add_filter('upgrader_source_selection', array($this, 'check_package') );
     847        // Clear cache so wp_update_plugins() knows about the new plugin.
     848        add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
    847849
    848850        $this->run( array(
     
    857859        ) );
    858860
     861        remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 );
    859862        remove_filter('upgrader_source_selection', array($this, 'check_package') );
    860863
     
    14091412        add_filter('upgrader_source_selection', array($this, 'check_package') );
    14101413        add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
     1414        // Clear cache so wp_update_themes() knows about the new theme.
     1415        add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
    14111416
    14121417        $this->run( array(
     
    14211426        ) );
    14221427
     1428        remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
    14231429        remove_filter('upgrader_source_selection', array($this, 'check_package') );
    14241430        remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'));
Note: See TracChangeset for help on using the changeset viewer.