WordPress.org

Make WordPress Core

Ticket #22515: 22515.2.diff

File 22515.2.diff, 3.1 KB (added by nacin, 8 years ago)
  • wp-admin/includes/class-wp-upgrader.php

     
    671671                /* translators: 1: theme name, 2: version */
    672672                $this->strings['parent_theme_currently_installed'] = __('The parent theme, <strong>%1$s %2$s</strong>, is currently installed.');
    673673                /* translators: 1: theme name, 2: version */
     674                $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>.' );
     675                /* translators: 1: theme name, 2: version */
     676                $this->strings['theme_broken'] = __( '<strong>%1$s %2$s</strong> is installed but &#8220;broken&#8221; and cannot be used.' );
     677                /* translators: 1: theme name, 2: version */
    674678                $this->strings['parent_theme_install_success'] = __('Successfully installed the parent theme, <strong>%1$s %2$s</strong>.');
    675679                $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.');
    676680        }
     
    684688
    685689                $this->skin->feedback( 'parent_theme_search' );
    686690
    687                 if ( ! $theme_info->parent()->errors() ) {
     691                if ( $theme_info->parent()->exists() ) {
     692                        // But, this installed parent theme is not a valid parent of the theme we're trying to install.
     693                        // (We assume later on that any theme we install now from WordPress.org *is* a valid parent theme.)
     694                        if ( $theme_info->errors() && in_array( 'theme_parent_invalid', $theme_info->errors()->get_error_codes() ) ) {
     695                                $name = $theme_info->display('Name');
     696                                $version = $theme_info->display('Version');
     697
     698                                $this->skin->feedback( 'parent_theme_invalid', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version' ), $name, $version );
     699
     700                                // The theme is installed, but broken. Eh, we'll call it a wash.
     701                                $this->strings['process_success'] = sprintf( $this->strings['theme_broken'], $name, $version );
     702                                add_filter('install_theme_complete_actions', array(&$this, 'hide_activate_preview_actions') );
     703                                return $install_result;
     704                        }
     705
    688706                        $this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version') );
     707
    689708                        // We already have the theme, fall through.
    690709                        return $install_result;
    691710                }
  • wp-includes/class-wp-theme.php

     
    254254                                // Parent theme is missing.
    255255                                $this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), $this->template ) );
    256256                                $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
     257                                $this->parent = new WP_Theme( $this->template, $this->theme_root, $this );
    257258                                return;
    258259                        }
    259260                }