Make WordPress Core


Ignore:
Timestamp:
03/21/2019 09:52:07 PM (6 years ago)
Author:
flixos90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r44924 r44973  
    10491049
    10501050/**
     1051 * Add a link to exit recovery mode when Recovery Mode is active.
     1052 *
     1053 * @since 5.2.0
     1054 *
     1055 * @param WP_Admin_Bar $wp_admin_bar
     1056 */
     1057function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) {
     1058    if ( ! wp_is_recovery_mode() ) {
     1059        return;
     1060    }
     1061
     1062    $url = wp_login_url();
     1063    $url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url );
     1064    $url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION );
     1065
     1066    $wp_admin_bar->add_menu(
     1067        array(
     1068            'parent' => 'top-secondary',
     1069            'id'     => 'recovery-mode',
     1070            'title'  => __( 'Exit Recovery Mode' ),
     1071            'href'   => $url,
     1072            'meta'   => array(
     1073                'title' => __( 'Exit Recovery Mode' ),
     1074            ),
     1075        )
     1076    );
     1077}
     1078
     1079/**
    10511080 * Add secondary menus.
    10521081 *
Note: See TracChangeset for help on using the changeset viewer.