diff --git a/src/wp-admin/includes/class-plugin-installer-skin.php b/src/wp-admin/includes/class-plugin-installer-skin.php
index 6a5cec123d..617d021168 100644
--- a/src/wp-admin/includes/class-plugin-installer-skin.php
+++ b/src/wp-admin/includes/class-plugin-installer-skin.php
@@ -186,7 +186,9 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$folder = ltrim( substr( $folder, strlen( WP_PLUGIN_DIR ) ), '/' );
$current_plugin_data = false;
- foreach ( get_plugins() as $plugin => $plugin_data ) {
+ $all_plugins = get_plugins();
+
+ foreach ( $all_plugins as $plugin => $plugin_data ) {
if ( strrpos( $plugin, $folder ) !== 0 ) {
continue;
}
@@ -194,13 +196,15 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$current_plugin_data = $plugin_data;
}
- if ( empty( $current_plugin_data ) || empty( $this->upgrader->new_plugin_data ) ) {
+ $new_plugin_data = $this->upgrader->new_plugin_data;
+
+ if ( ! $current_plugin_data || ! $new_plugin_data ) {
return false;
}
echo '
' . esc_html( __( 'This plugin is already installed.' ) ) . '
';
- $this->is_downgrading = version_compare( $current_plugin_data['Version'], $this->upgrader->new_plugin_data['Version'], '>' );
+ $this->is_downgrading = version_compare( $current_plugin_data['Version'], $new_plugin_data['Version'], '>' );
$rows = array(
'Name' => __( 'Plugin name' ),
@@ -218,7 +222,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
foreach ( $rows as $field => $label ) {
$old_value = ! empty( $current_plugin_data[ $field ] ) ? (string) $current_plugin_data[ $field ] : '-';
- $new_value = ! empty( $this->upgrader->new_plugin_data[ $field ] ) ? (string) $this->upgrader->new_plugin_data[ $field ] : '-';
+ $new_value = ! empty( $new_plugin_data[ $field ] ) ? (string) $new_plugin_data[ $field ] : '-';
$is_same_plugin = $is_same_plugin && ( $old_value === $new_value );
@@ -241,7 +245,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
* @param array $current_plugin_data Array with current plugin data.
* @param array $new_plugin_data Array with uploaded plugin data.
*/
- echo apply_filters( 'install_plugin_ovewrite_comparison', $table, $current_plugin_data, $this->upgrader->new_plugin_data );
+ echo apply_filters( 'install_plugin_ovewrite_comparison', $table, $current_plugin_data, $new_plugin_data );
$install_actions = array();
$can_update = true;
@@ -249,28 +253,27 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$blocked_message = '' . esc_html( __( 'The plugin cannot be updated due to the following:' ) ) . '
';
$blocked_message .= '