From 0c68064fd3996e08b8829b50c756f6a699d8f574 Mon Sep 17 00:00:00 2001
From: Paul Biron <paul@sparrowhawkcomputing.com>
Date: Thu, 10 Sep 2020 15:45:09 -0600
Subject: [PATCH] Upgrade/install: Include version updated from in plugin and
theme auto-updates email notifications.
---
.../includes/class-wp-automatic-updater.php | 30 ++++++++++++++-----
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php
index 9cf0a04ac1..754496a73a 100644
a
|
b
|
class WP_Automatic_Updater { |
343 | 343 | $upgrader_item = $item->theme; |
344 | 344 | $theme = wp_get_theme( $upgrader_item ); |
345 | 345 | $item_name = $theme->Get( 'Name' ); |
| 346 | // Add the current version so the it can be reported in the notification email. |
| 347 | $item->current_version = $theme->get( 'Version' ); |
| 348 | if ( empty( $item->current_version ) ) { |
| 349 | $item->current_version = _x( 'Unknown', 'Theme current version' ); |
| 350 | } |
346 | 351 | /* translators: %s: Theme name. */ |
347 | 352 | $skin->feedback( __( 'Updating theme: %s' ), $item_name ); |
348 | 353 | break; |
… |
… |
class WP_Automatic_Updater { |
350 | 355 | $upgrader_item = $item->plugin; |
351 | 356 | $plugin_data = get_plugin_data( $context . '/' . $upgrader_item ); |
352 | 357 | $item_name = $plugin_data['Name']; |
| 358 | // Add the current version so the it can be reported in the notification email. |
| 359 | $item->current_version = $plugin_data['Version']; |
| 360 | if ( empty( $item->current_version ) ) { |
| 361 | $item->current_version = _x( 'Unknown', 'Plugin current version' ); |
| 362 | } |
353 | 363 | /* translators: %s: Plugin name. */ |
354 | 364 | $skin->feedback( __( 'Updating plugin: %s' ), $item_name ); |
355 | 365 | break; |
… |
… |
class WP_Automatic_Updater { |
1062 | 1072 | |
1063 | 1073 | foreach ( $failed_updates['plugin'] as $item ) { |
1064 | 1074 | $body[] = sprintf( |
1065 | | /* translators: 1: Plugin name, 2: Version number. */ |
1066 | | __( '- %1$s version %2$s' ), |
| 1075 | /* translators: 1: Plugin name, 2: Current version number, 3: New version number. */ |
| 1076 | __( '- %1$s (from version %2$s to %3$s)' ), |
1067 | 1077 | $item->name, |
| 1078 | $item->item->current_version, |
1068 | 1079 | $item->item->new_version |
1069 | 1080 | ); |
1070 | 1081 | |
… |
… |
class WP_Automatic_Updater { |
1080 | 1091 | |
1081 | 1092 | foreach ( $failed_updates['theme'] as $item ) { |
1082 | 1093 | $body[] = sprintf( |
1083 | | /* translators: 1: Theme name, 2: Version number. */ |
1084 | | __( '- %1$s version %2$s' ), |
| 1094 | /* translators: 1: Theme name, 2: Current version number, 3: New version number. */ |
| 1095 | __( '- %1$s (from version %2$s to %3$s)' ), |
1085 | 1096 | $item->name, |
| 1097 | $item->item->current_version, |
1086 | 1098 | $item->item->new_version |
1087 | 1099 | ); |
1088 | 1100 | |
… |
… |
class WP_Automatic_Updater { |
1103 | 1115 | |
1104 | 1116 | foreach ( $successful_updates['plugin'] as $item ) { |
1105 | 1117 | $body[] = sprintf( |
1106 | | /* translators: 1: Plugin name, 2: Version number. */ |
1107 | | __( '- %1$s version %2$s' ), |
| 1118 | /* translators: 1: Plugin name, 2: Current version number, 3: New version number. */ |
| 1119 | __( '- %1$s (from version %2$s to %3$s)' ), |
1108 | 1120 | $item->name, |
| 1121 | $item->item->current_version, |
1109 | 1122 | $item->item->new_version |
1110 | 1123 | ); |
1111 | 1124 | |
… |
… |
class WP_Automatic_Updater { |
1121 | 1134 | |
1122 | 1135 | foreach ( $successful_updates['theme'] as $item ) { |
1123 | 1136 | $body[] = sprintf( |
1124 | | /* translators: 1: Theme name, 2: Version number. */ |
1125 | | __( '- %1$s version %2$s' ), |
| 1137 | /* translators: 1: Theme name, 2: Current version number, 3: New version number. */ |
| 1138 | __( '- %1$s (from version %2$s to %3$s)' ), |
1126 | 1139 | $item->name, |
| 1140 | $item->item->current_version, |
1127 | 1141 | $item->item->new_version |
1128 | 1142 | ); |
1129 | 1143 | |