Upgrade/Install: Include "from" version for plugins/themes in email.

This can help with chasing down any issues that may arise and rolling back if necessary. We hope it's not, but it might be.

Props dkotter, garrett-eclipse, pbiron, audrasjb.
Fixes #50774.

Built from https://develop.svn.wordpress.org/trunk@49242


git-svn-id: http://core.svn.wordpress.org/trunk@49004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2020-10-20 17:41:07 +00:00
parent e38c5ca7d4
commit c8fbc04276
2 changed files with 75 additions and 25 deletions

View File

@ -348,6 +348,11 @@ class WP_Automatic_Updater {
$upgrader_item = $item->theme; $upgrader_item = $item->theme;
$theme = wp_get_theme( $upgrader_item ); $theme = wp_get_theme( $upgrader_item );
$item_name = $theme->Get( 'Name' ); $item_name = $theme->Get( 'Name' );
// Add the current version so that it can be reported in the notification email.
$item->current_version = $theme->get( 'Version' );
if ( empty( $item->current_version ) ) {
$item->current_version = false;
}
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
$skin->feedback( __( 'Updating theme: %s' ), $item_name ); $skin->feedback( __( 'Updating theme: %s' ), $item_name );
break; break;
@ -355,6 +360,11 @@ class WP_Automatic_Updater {
$upgrader_item = $item->plugin; $upgrader_item = $item->plugin;
$plugin_data = get_plugin_data( $context . '/' . $upgrader_item ); $plugin_data = get_plugin_data( $context . '/' . $upgrader_item );
$item_name = $plugin_data['Name']; $item_name = $plugin_data['Name'];
// Add the current version so that it can be reported in the notification email.
$item->current_version = $plugin_data['Version'];
if ( empty( $item->current_version ) ) {
$item->current_version = false;
}
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
$skin->feedback( __( 'Updating plugin: %s' ), $item_name ); $skin->feedback( __( 'Updating plugin: %s' ), $item_name );
break; break;
@ -1070,12 +1080,22 @@ class WP_Automatic_Updater {
$body[] = __( 'These plugins failed to update:' ); $body[] = __( 'These plugins failed to update:' );
foreach ( $failed_updates['plugin'] as $item ) { foreach ( $failed_updates['plugin'] as $item ) {
if ( $item->item->current_version ) {
$body[] = sprintf(
/* translators: 1: Plugin name, 2: Current version number, 3: New version number. */
__( '- %1$s (from version %2$s to %3$s)' ),
$item->name,
$item->item->current_version,
$item->item->new_version
);
} else {
$body[] = sprintf( $body[] = sprintf(
/* translators: 1: Plugin name, 2: Version number. */ /* translators: 1: Plugin name, 2: Version number. */
__( '- %1$s version %2$s' ), __( '- %1$s version %2$s' ),
$item->name, $item->name,
$item->item->new_version $item->item->new_version
); );
}
$past_failure_emails[ $item->item->plugin ] = $item->item->new_version; $past_failure_emails[ $item->item->plugin ] = $item->item->new_version;
} }
@ -1088,12 +1108,22 @@ class WP_Automatic_Updater {
$body[] = __( 'These themes failed to update:' ); $body[] = __( 'These themes failed to update:' );
foreach ( $failed_updates['theme'] as $item ) { foreach ( $failed_updates['theme'] as $item ) {
if ( $item->item->current_version ) {
$body[] = sprintf(
/* translators: 1: Theme name, 2: Current version number, 3: New version number. */
__( '- %1$s (from version %2$s to %3$s)' ),
$item->name,
$item->item->current_version,
$item->item->new_version
);
} else {
$body[] = sprintf( $body[] = sprintf(
/* translators: 1: Theme name, 2: Version number. */ /* translators: 1: Theme name, 2: Version number. */
__( '- %1$s version %2$s' ), __( '- %1$s version %2$s' ),
$item->name, $item->name,
$item->item->new_version $item->item->new_version
); );
}
$past_failure_emails[ $item->item->theme ] = $item->item->new_version; $past_failure_emails[ $item->item->theme ] = $item->item->new_version;
} }
@ -1111,12 +1141,22 @@ class WP_Automatic_Updater {
$body[] = __( 'These plugins are now up to date:' ); $body[] = __( 'These plugins are now up to date:' );
foreach ( $successful_updates['plugin'] as $item ) { foreach ( $successful_updates['plugin'] as $item ) {
if ( $item->item->current_version ) {
$body[] = sprintf(
/* translators: 1: Plugin name, 2: Current version number, 3: New version number. */
__( '- %1$s (from version %2$s to %3$s)' ),
$item->name,
$item->item->current_version,
$item->item->new_version
);
} else {
$body[] = sprintf( $body[] = sprintf(
/* translators: 1: Plugin name, 2: Version number. */ /* translators: 1: Plugin name, 2: Version number. */
__( '- %1$s version %2$s' ), __( '- %1$s version %2$s' ),
$item->name, $item->name,
$item->item->new_version $item->item->new_version
); );
}
unset( $past_failure_emails[ $item->item->plugin ] ); unset( $past_failure_emails[ $item->item->plugin ] );
} }
@ -1129,12 +1169,22 @@ class WP_Automatic_Updater {
$body[] = __( 'These themes are now up to date:' ); $body[] = __( 'These themes are now up to date:' );
foreach ( $successful_updates['theme'] as $item ) { foreach ( $successful_updates['theme'] as $item ) {
if ( $item->item->current_version ) {
$body[] = sprintf(
/* translators: 1: Theme name, 2: Current version number, 3: New version number. */
__( '- %1$s (from version %2$s to %3$s)' ),
$item->name,
$item->item->current_version,
$item->item->new_version
);
} else {
$body[] = sprintf( $body[] = sprintf(
/* translators: 1: Theme name, 2: Version number. */ /* translators: 1: Theme name, 2: Version number. */
__( '- %1$s version %2$s' ), __( '- %1$s version %2$s' ),
$item->name, $item->name,
$item->item->new_version $item->item->new_version
); );
}
unset( $past_failure_emails[ $item->item->theme ] ); unset( $past_failure_emails[ $item->item->theme ] );
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6-alpha-49241'; $wp_version = '5.6-alpha-49242';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.