| 1 | Index: wp-admin/includes/class-wp-upgrader.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/class-wp-upgrader.php (revision 22730) |
|---|
| 4 | +++ wp-admin/includes/class-wp-upgrader.php (working copy) |
|---|
| 5 | @@ -671,6 +671,10 @@ |
|---|
| 6 | /* translators: 1: theme name, 2: version */ |
|---|
| 7 | $this->strings['parent_theme_currently_installed'] = __('The parent theme, <strong>%1$s %2$s</strong>, is currently installed.'); |
|---|
| 8 | /* translators: 1: theme name, 2: version */ |
|---|
| 9 | + $this->strings['parent_theme_invalid'] = __( '<strong>%1$s %2$s</strong>, is currently installed, but it is not a valid parent theme for <strong>%3$s %4$s</strong>.' ); |
|---|
| 10 | + /* translators: 1: theme name, 2: version */ |
|---|
| 11 | + $this->strings['theme_broken'] = __( '<strong>%1$s %2$s</strong> is installed but “broken” and cannot be used.' ); |
|---|
| 12 | + /* translators: 1: theme name, 2: version */ |
|---|
| 13 | $this->strings['parent_theme_install_success'] = __('Successfully installed the parent theme, <strong>%1$s %2$s</strong>.'); |
|---|
| 14 | $this->strings['parent_theme_not_found'] = __('<strong>The parent theme could not be found.</strong> You will need to install the parent theme, <strong>%s</strong>, before you can use this child theme.'); |
|---|
| 15 | } |
|---|
| 16 | @@ -684,8 +688,23 @@ |
|---|
| 17 | |
|---|
| 18 | $this->skin->feedback( 'parent_theme_search' ); |
|---|
| 19 | |
|---|
| 20 | - if ( ! $theme_info->parent()->errors() ) { |
|---|
| 21 | + if ( $theme_info->parent()->exists() ) { |
|---|
| 22 | + // But, this installed parent theme is not a valid parent of the theme we're trying to install. |
|---|
| 23 | + // (We assume later on that any theme we install now from WordPress.org *is* a valid parent theme.) |
|---|
| 24 | + if ( $theme_info->errors() && in_array( 'theme_parent_invalid', $theme_info->errors()->get_error_codes() ) ) { |
|---|
| 25 | + $name = $theme_info->display('Name'); |
|---|
| 26 | + $version = $theme_info->display('Version'); |
|---|
| 27 | + |
|---|
| 28 | + $this->skin->feedback( 'parent_theme_invalid', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version' ), $name, $version ); |
|---|
| 29 | + |
|---|
| 30 | + // The theme is installed, but broken. Eh, we'll call it a wash. |
|---|
| 31 | + $this->strings['process_success'] = sprintf( $this->strings['theme_broken'], $name, $version ); |
|---|
| 32 | + add_filter('install_theme_complete_actions', array(&$this, 'hide_activate_preview_actions') ); |
|---|
| 33 | + return $install_result; |
|---|
| 34 | + } |
|---|
| 35 | + |
|---|
| 36 | $this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version') ); |
|---|
| 37 | + |
|---|
| 38 | // We already have the theme, fall through. |
|---|
| 39 | return $install_result; |
|---|
| 40 | } |
|---|
| 41 | Index: wp-includes/class-wp-theme.php |
|---|
| 42 | =================================================================== |
|---|
| 43 | --- wp-includes/class-wp-theme.php (revision 22730) |
|---|
| 44 | +++ wp-includes/class-wp-theme.php (working copy) |
|---|
| 45 | @@ -254,6 +254,7 @@ |
|---|
| 46 | // Parent theme is missing. |
|---|
| 47 | $this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), $this->template ) ); |
|---|
| 48 | $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) ); |
|---|
| 49 | + $this->parent = new WP_Theme( $this->template, $this->theme_root, $this ); |
|---|
| 50 | return; |
|---|
| 51 | } |
|---|
| 52 | } |
|---|