-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Administration: Add last fatal PHP error to auto-update failure emails #10445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from 4 commits
a5e78c5
755902c
c36f172
e2cd6fd
c63ae8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1540,6 +1540,16 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_ | |||||
| */ | ||||||
| $email = apply_filters( 'auto_plugin_theme_update_email', $email, $type, $successful_updates, $failed_updates ); | ||||||
|
|
||||||
| if ( defined( 'WP_DEBUG' ) && WP_DEBUG && 'fail' === $type ) { | ||||||
| $fatal_error = get_transient( 'wp_last_fatal_error' ); | ||||||
| if ( $fatal_error ) { | ||||||
| $email['body'] .= "\n\n=== LAST FATAL PHP ERROR ===\n"; | ||||||
|
||||||
| $email['body'] .= "\n\n=== LAST FATAL PHP ERROR ===\n"; | |
| $email['body'] .= "\n\n=== " . __( 'LAST FATAL PHP ERROR' ) . " ===\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be translated? I suppose it wouldn't be translated in the error log either.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use whatever the error_log is set to in the PHP config.
| $log_file = WP_CONTENT_DIR . '/debug.log'; | |
| $log_file = ini_get( 'error_log' ); |
For another approach at parsing the error log, consider this code from the AMP plugin: https://github.com/ampproject/amp-wp/blob/2.5.4/src/Support/SupportData.php#L351-L410
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the transient's name should be specific to the updater to distinguish it from any other general captures of the last fatal error (if we ever do that). So maybe like wp_updater_last_fatal_error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@westonruter All feedback addressed — thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant is always defined in
default-constants.phpso the initial check can be removed: