From da730fce4d2de19f03f83a34484d69078f583664 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 16 Jul 2020 13:17:13 +0000 Subject: [PATCH] Upgrade/Install: Check if the theme installer skin's `overwrite` property exists in `Theme_Upgrader::install_strings()`. This ensures consistency with `Plugin_Upgrader::install_strings()` and resolves an issue caused by the property not existing in other upgrader implementations. Props schlessera, azaozz. See #50670. git-svn-id: https://develop.svn.wordpress.org/trunk@48493 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-theme-upgrader.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/wp-admin/includes/class-theme-upgrader.php b/src/wp-admin/includes/class-theme-upgrader.php index 466bb29796..4ff5109e63 100644 --- a/src/wp-admin/includes/class-theme-upgrader.php +++ b/src/wp-admin/includes/class-theme-upgrader.php @@ -94,16 +94,18 @@ class Theme_Upgrader extends WP_Upgrader { /* translators: %s: Theme error. */ $this->strings['current_theme_has_errors'] = __( 'The current theme has the following error: "%s".' ); - if ( 'update-theme' === $this->skin->overwrite ) { - $this->strings['installing_package'] = __( 'Updating the theme…' ); - $this->strings['process_failed'] = __( 'Theme update failed.' ); - $this->strings['process_success'] = __( 'Theme updated successfully.' ); - } + if ( ! empty( $this->skin->overwrite ) ) { + if ( 'update-theme' === $this->skin->overwrite ) { + $this->strings['installing_package'] = __( 'Updating the theme…' ); + $this->strings['process_failed'] = __( 'Theme update failed.' ); + $this->strings['process_success'] = __( 'Theme updated successfully.' ); + } - if ( 'downgrade-theme' === $this->skin->overwrite ) { - $this->strings['installing_package'] = __( 'Downgrading the theme…' ); - $this->strings['process_failed'] = __( 'Theme downgrade failed.' ); - $this->strings['process_success'] = __( 'Theme downgraded successfully.' ); + if ( 'downgrade-theme' === $this->skin->overwrite ) { + $this->strings['installing_package'] = __( 'Downgrading the theme…' ); + $this->strings['process_failed'] = __( 'Theme downgrade failed.' ); + $this->strings['process_success'] = __( 'Theme downgraded successfully.' ); + } } }