Upgrade/Install: Check if plugin or theme update results are available before applying the notification filters.
This avoids a PHP notice for an undefined index of either `plugin` or `theme` in the `auto_{plugin|theme}_update_send_email` filter hook. Props afragen, audrasjb. Fixes #51400. Built from https://develop.svn.wordpress.org/trunk@49166 git-svn-id: http://core.svn.wordpress.org/trunk@48928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3c1961faa1
commit
df51aa9b6f
|
@ -892,6 +892,7 @@ class WP_Automatic_Updater {
|
|||
$successful_updates = array();
|
||||
$failed_updates = array();
|
||||
|
||||
if ( ! empty( $update_results['plugin'] ) ) {
|
||||
/**
|
||||
* Filters whether to send an email following an automatic background plugin update.
|
||||
*
|
||||
|
@ -903,7 +904,7 @@ class WP_Automatic_Updater {
|
|||
*/
|
||||
$notifications_enabled = apply_filters( 'auto_plugin_update_send_email', true, $update_results['plugin'] );
|
||||
|
||||
if ( ! empty( $update_results['plugin'] ) && $notifications_enabled ) {
|
||||
if ( $notifications_enabled ) {
|
||||
foreach ( $update_results['plugin'] as $update_result ) {
|
||||
if ( true === $update_result->result ) {
|
||||
$successful_updates['plugin'][] = $update_result;
|
||||
|
@ -912,7 +913,9 @@ class WP_Automatic_Updater {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $update_results['theme'] ) ) {
|
||||
/**
|
||||
* Filters whether to send an email following an automatic background theme update.
|
||||
*
|
||||
|
@ -924,7 +927,7 @@ class WP_Automatic_Updater {
|
|||
*/
|
||||
$notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] );
|
||||
|
||||
if ( ! empty( $update_results['theme'] ) && $notifications_enabled ) {
|
||||
if ( $notifications_enabled ) {
|
||||
foreach ( $update_results['theme'] as $update_result ) {
|
||||
if ( true === $update_result->result ) {
|
||||
$successful_updates['theme'][] = $update_result;
|
||||
|
@ -933,6 +936,7 @@ class WP_Automatic_Updater {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $successful_updates ) && empty( $failed_updates ) ) {
|
||||
return;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-alpha-49165';
|
||||
$wp_version = '5.6-alpha-49166';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue