WordPress.org

Make WordPress Core

Changeset 21080


Ignore:
Timestamp:
06/14/12 14:24:25 (3 years ago)
Author:
nacin
Message:

Introduce wp_clean_themes_cache() for upgrades and testing. fixes #20954.

Location:
trunk
Files:
2 edited

Legend:

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

    r21064 r21080  
    764764 
    765765        // Force refresh of theme update information 
    766         delete_site_transient('update_themes'); 
    767         search_theme_directories( true ); 
    768         foreach ( wp_get_themes() as $theme ) 
    769             $theme->cache_delete(); 
     766        wp_clean_themes_cache(); 
    770767 
    771768        return true; 
     
    813810 
    814811        // Force refresh of theme update information 
    815         delete_site_transient('update_themes'); 
    816         search_theme_directories( true ); 
    817         foreach ( wp_get_themes() as $theme ) 
    818             $theme->cache_delete(); 
     812        wp_clean_themes_cache(); 
    819813 
    820814        return true; 
     
    903897 
    904898        // Force refresh of theme update information 
    905         delete_site_transient('update_themes'); 
    906         search_theme_directories( true ); 
    907         foreach ( wp_get_themes() as $theme ) 
    908             $theme->cache_delete(); 
     899        wp_clean_themes_cache(); 
    909900 
    910901        return $results; 
  • trunk/wp-includes/theme.php

    r21063 r21080  
    105105 
    106106    return new WP_Theme( $stylesheet, $theme_root ); 
     107} 
     108 
     109/** 
     110 * Clears the cache held by get_theme_roots() and WP_Theme. 
     111 * 
     112 * @since 3.5.0 
     113 */ 
     114function wp_clean_themes_cache() { 
     115    delete_site_transient('update_themes'); 
     116    search_theme_directories( true ); 
     117    foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme ) 
     118        $theme->cache_delete(); 
    107119} 
    108120 
Note: See TracChangeset for help on using the changeset viewer.