mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-02 01:20:03 +00:00
Bootstrap/Load: Introduce a recovery mode for fixing fatal errors.
Using the new fatal handler introduced in [44962], an email is sent to the admin when a fatal error occurs. This email includes a secret link to enter recovery mode. When clicked, the link will be validated and on success a cookie will be placed on the client, enabling recovery mode for that user. This functionality is executed early before plugins and themes are loaded, in order to be unaffected by potential fatal errors these might be causing. When in recovery mode, broken plugins and themes will be paused for that client, so that they are able to access the admin backend despite of these errors. They are notified about the broken extensions and the errors caused, and can then decide whether they would like to temporarily deactivate the extension or fix the problem and resume the extension. A link in the admin bar allows the client to exit recovery mode. Props timothyblynjacobs, afragen, flixos90, nerrad, miss_jwo, schlessera, spacedmonkey, swissspidy. Fixes #46130, #44458. git-svn-id: https://develop.svn.wordpress.org/trunk@44973 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -389,6 +389,26 @@ if ( $action ) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'resume':
|
||||
if ( is_multisite() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'resume_plugin', $plugin ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to resume this plugin.' ) );
|
||||
}
|
||||
|
||||
check_admin_referer( 'resume-plugin_' . $plugin );
|
||||
|
||||
$result = resume_plugin( $plugin, self_admin_url( "plugins.php?error=resuming&plugin_status=$status&paged=$page&s=$s" ) );
|
||||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
wp_die( $result );
|
||||
}
|
||||
|
||||
wp_redirect( self_admin_url( "plugins.php?resume=true&plugin_status=$status&paged=$page&s=$s" ) );
|
||||
exit;
|
||||
|
||||
default:
|
||||
if ( isset( $_POST['checked'] ) ) {
|
||||
check_admin_referer( 'bulk-plugins' );
|
||||
@@ -488,6 +508,8 @@ if ( isset( $_GET['error'] ) ) :
|
||||
$_GET['charsout']
|
||||
);
|
||||
$errmsg .= ' ' . __( 'If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' );
|
||||
} elseif ( 'resuming' === $_GET['error'] ) {
|
||||
$errmsg = __( 'Plugin could not be resumed because it triggered a <strong>fatal error</strong>.' );
|
||||
} else {
|
||||
$errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' );
|
||||
}
|
||||
@@ -541,6 +563,8 @@ elseif ( isset( $_GET['deleted'] ) ) :
|
||||
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins <strong>deactivated</strong>.' ); ?></p></div>
|
||||
<?php elseif ( 'update-selected' == $action ) : ?>
|
||||
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.' ); ?></p></div>
|
||||
<?php elseif ( isset( $_GET['resume'] ) ) : ?>
|
||||
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>resumed</strong>.' ); ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
Reference in New Issue
Block a user