Make WordPress Core


Ignore:
Timestamp:
11/25/2015 09:44:02 PM (9 years ago)
Author:
wonderboymusic
Message:

Upgrade: New themes are not automatically installed on upgrade. This can still be explicitly asked for by defining CORE_UPGRADE_SKIP_NEW_BUNDLED as false.

In populate_options(), if the theme specified by WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme. If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do.

Props nacin, jeremyfelt, dd32.
See #34306.

File:
1 edited

Legend:

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

    r35688 r35738  
    369369    }
    370370
    371     $template = WP_DEFAULT_THEME;
    372     // If default theme is a child theme, we need to get its template
    373     $theme = wp_get_theme( $template );
    374     if ( ! $theme->errors() )
    375         $template = $theme->get_template();
     371    // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
     372    $stylesheet = $template = WP_DEFAULT_THEME;
     373    $theme = wp_get_theme( WP_DEFAULT_THEME );
     374    if ( ! $theme->exists() ) {
     375        $theme = WP_Theme::get_core_default_theme();
     376    }
     377
     378    // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do.
     379    if ( $theme ) {
     380        $stylesheet = $theme->get_stylesheet();
     381        $template   = $theme->get_template();
     382    }
    376383
    377384    $timezone_string = '';
     
    434441    'recently_edited' => '',
    435442    'template' => $template,
    436     'stylesheet' => WP_DEFAULT_THEME,
     443    'stylesheet' => $stylesheet,
    437444    'comment_whitelist' => 1,
    438445    'blacklist_keys' => '',
     
    915922    $stylesheet = get_option( 'stylesheet' );
    916923    $allowed_themes = array( $stylesheet => true );
    917     if ( $template != $stylesheet )
     924
     925    if ( $template != $stylesheet ) {
    918926        $allowed_themes[ $template ] = true;
    919     if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template )
     927    }
     928
     929    if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) {
    920930        $allowed_themes[ WP_DEFAULT_THEME ] = true;
     931    }
     932
     933    // If WP_DEFAULT_THEME doesn't exist, also whitelist the latest core default theme.
     934    if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) {
     935        if ( $core_default = WP_Theme::get_core_default_theme() ) {
     936            $allowed_themes[ $core_default->get_stylesheet() ] = true;
     937        }
     938    }
    921939
    922940    if ( 1 == $network_id ) {
Note: See TracChangeset for help on using the changeset viewer.