equal
deleted
inserted
replaced
750 wp_update_plugins(); // Check for plugin updates. |
750 wp_update_plugins(); // Check for plugin updates. |
751 } |
751 } |
752 |
752 |
753 // Send debugging email to admin for all development installations. |
753 // Send debugging email to admin for all development installations. |
754 if ( ! empty( $this->update_results ) ) { |
754 if ( ! empty( $this->update_results ) ) { |
755 $development_version = str_contains( get_bloginfo( 'version' ), '-' ); |
755 $development_version = str_contains( wp_get_wp_version(), '-' ); |
756 |
756 |
757 /** |
757 /** |
758 * Filters whether to send a debugging email for each automatic background update. |
758 * Filters whether to send a debugging email for each automatic background update. |
759 * |
759 * |
760 * @since 3.7.0 |
760 * @since 3.7.0 |
793 * @since 3.7.0 |
793 * @since 3.7.0 |
794 * |
794 * |
795 * @param object $update_result The result of the core update. Includes the update offer and result. |
795 * @param object $update_result The result of the core update. Includes the update offer and result. |
796 */ |
796 */ |
797 protected function after_core_update( $update_result ) { |
797 protected function after_core_update( $update_result ) { |
798 $wp_version = get_bloginfo( 'version' ); |
798 $wp_version = wp_get_wp_version(); |
799 |
799 |
800 $core_update = $update_result->item; |
800 $core_update = $update_result->item; |
801 $result = $update_result->result; |
801 $result = $update_result->result; |
802 |
802 |
803 if ( ! is_wp_error( $result ) ) { |
803 if ( ! is_wp_error( $result ) ) { |
932 * @param object $core_update The update offer that was attempted. |
932 * @param object $core_update The update offer that was attempted. |
933 * @param mixed $result The result for the core update. Can be WP_Error. |
933 * @param mixed $result The result for the core update. Can be WP_Error. |
934 */ |
934 */ |
935 if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) { |
935 if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) { |
936 return; |
936 return; |
|
937 } |
|
938 |
|
939 $admin_user = get_user_by( 'email', get_site_option( 'admin_email' ) ); |
|
940 |
|
941 if ( $admin_user ) { |
|
942 $switched_locale = switch_to_user_locale( $admin_user->ID ); |
|
943 } else { |
|
944 $switched_locale = switch_to_locale( get_locale() ); |
937 } |
945 } |
938 |
946 |
939 switch ( $type ) { |
947 switch ( $type ) { |
940 case 'success': // We updated. |
948 case 'success': // We updated. |
941 /* translators: Site updated notification email subject. 1: Site title, 2: WordPress version. */ |
949 /* translators: Site updated notification email subject. 1: Site title, 2: WordPress version. */ |
1137 * @param mixed $result The result for the core update. Can be WP_Error. |
1145 * @param mixed $result The result for the core update. Can be WP_Error. |
1138 */ |
1146 */ |
1139 $email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result ); |
1147 $email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result ); |
1140 |
1148 |
1141 wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
1149 wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
|
1150 |
|
1151 if ( $switched_locale ) { |
|
1152 restore_previous_locale(); |
|
1153 } |
1142 } |
1154 } |
1143 |
|
1144 |
1155 |
1145 /** |
1156 /** |
1146 * Checks whether an email should be sent after attempting plugin or theme updates. |
1157 * Checks whether an email should be sent after attempting plugin or theme updates. |
1147 * |
1158 * |
1148 * @since 5.5.0 |
1159 * @since 5.5.0 |
1251 } |
1262 } |
1252 |
1263 |
1253 if ( ! $unique_failures ) { |
1264 if ( ! $unique_failures ) { |
1254 return; |
1265 return; |
1255 } |
1266 } |
|
1267 } |
|
1268 |
|
1269 $admin_user = get_user_by( 'email', get_site_option( 'admin_email' ) ); |
|
1270 |
|
1271 if ( $admin_user ) { |
|
1272 $switched_locale = switch_to_user_locale( $admin_user->ID ); |
|
1273 } else { |
|
1274 $switched_locale = switch_to_locale( get_locale() ); |
1256 } |
1275 } |
1257 |
1276 |
1258 $body = array(); |
1277 $body = array(); |
1259 $successful_plugins = ( ! empty( $successful_updates['plugin'] ) ); |
1278 $successful_plugins = ( ! empty( $successful_updates['plugin'] ) ); |
1260 $successful_themes = ( ! empty( $successful_updates['theme'] ) ); |
1279 $successful_themes = ( ! empty( $successful_updates['theme'] ) ); |
1524 $result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
1543 $result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
1525 |
1544 |
1526 if ( $result ) { |
1545 if ( $result ) { |
1527 update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); |
1546 update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); |
1528 } |
1547 } |
|
1548 |
|
1549 if ( $switched_locale ) { |
|
1550 restore_previous_locale(); |
|
1551 } |
1529 } |
1552 } |
1530 |
1553 |
1531 /** |
1554 /** |
1532 * Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
1555 * Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
1533 * |
1556 * |
1534 * @since 3.7.0 |
1557 * @since 3.7.0 |
1535 */ |
1558 */ |
1536 protected function send_debug_email() { |
1559 protected function send_debug_email() { |
1537 $update_count = 0; |
1560 $admin_user = get_user_by( 'email', get_site_option( 'admin_email' ) ); |
1538 foreach ( $this->update_results as $type => $updates ) { |
1561 |
1539 $update_count += count( $updates ); |
1562 if ( $admin_user ) { |
|
1563 $switched_locale = switch_to_user_locale( $admin_user->ID ); |
|
1564 } else { |
|
1565 $switched_locale = switch_to_locale( get_locale() ); |
1540 } |
1566 } |
1541 |
1567 |
1542 $body = array(); |
1568 $body = array(); |
1543 $failures = 0; |
1569 $failures = 0; |
1544 |
1570 |
1713 * @param mixed $results The results of all attempted updates. |
1739 * @param mixed $results The results of all attempted updates. |
1714 */ |
1740 */ |
1715 $email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results ); |
1741 $email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results ); |
1716 |
1742 |
1717 wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
1743 wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
|
1744 |
|
1745 if ( $switched_locale ) { |
|
1746 restore_previous_locale(); |
|
1747 } |
1718 } |
1748 } |
1719 |
1749 |
1720 /** |
1750 /** |
1721 * Performs a loopback request to check for potential fatal errors. |
1751 * Performs a loopback request to check for potential fatal errors. |
1722 * |
1752 * |