WordPress.org

Make WordPress Core

Changeset 16424


Ignore:
Timestamp:
11/17/2010 04:11:44 PM (9 years ago)
Author:
ryan
Message:

Register the default theme dir in wp-settings.php so that it is registered even when get_themes() doesn't run. Fix counting of theme dirs. Add option to get_raw_theme_root() to disregard the current theme root cache. see #14911

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r16340 r16424  
    267267    if ( isset($wp_themes) )
    268268        return $wp_themes;
    269 
    270     /* Register the default root as a theme directory */
    271     register_theme_directory( get_theme_root() );
    272269
    273270    if ( !$theme_files = search_theme_directories() )
     
    476473    global $wp_theme_directories;
    477474
    478     if ( count($wp_theme_directories <= 1) )
     475    if ( count($wp_theme_directories) <= 1 )
    479476        return '/themes';
    480477
     
    704701 * @return string Theme root
    705702 */
    706 function get_raw_theme_root( $stylesheet_or_template ) {
     703function get_raw_theme_root( $stylesheet_or_template, $no_cache = false ) {
    707704    global $wp_theme_directories;
    708705
    709     if ( count($wp_theme_directories <= 1) )
     706    if ( count($wp_theme_directories) <= 1 )
    710707        return '/themes';
    711708
     
    713710
    714711    // If requesting the root for the current theme, consult options to avoid calling get_theme_roots()
    715     if ( get_option('stylesheet') == $stylesheet_or_template )
    716         $theme_root = get_option('stylesheet_root');
    717     elseif ( get_option('template') == $stylesheet_or_template )
    718         $theme_root = get_option('template_root');
     712    if ( !$no_cache ) {
     713        if ( get_option('stylesheet') == $stylesheet_or_template )
     714            $theme_root = get_option('stylesheet_root');
     715        elseif ( get_option('template') == $stylesheet_or_template )
     716            $theme_root = get_option('template_root');
     717    }
    719718
    720719    if ( empty($theme_root) ) {
     
    12491248    update_option('stylesheet', $stylesheet);
    12501249    if ( count($wp_theme_directories) > 1 ) {
    1251         update_option('template_root', get_raw_theme_root($template));
    1252         update_option('stylesheet_root', get_raw_theme_root($stylesheet));
     1250        update_option('template_root', get_raw_theme_root($template, true));
     1251        update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));
    12531252    }
    12541253    delete_option('current_theme');
  • trunk/wp-settings.php

    r16353 r16424  
    175175create_initial_post_types();
    176176
     177// Register the default theme directory root
     178register_theme_directory( get_theme_root() );
     179
    177180// Load active plugins.
    178181foreach ( wp_get_active_and_valid_plugins() as $plugin )
Note: See TracChangeset for help on using the changeset viewer.