Bootstrap/Load: Revert fatal error recovery mechanism from 5.1 to polish for 5.2.

Due to the high number of follow-up tickets and associated security concerns, it was decided to reschedule the fatal error recovery feature for WordPress 5.2, in order to address these issues properly. The feature will continue to be developed, with iterations being merged into trunk early in the 5.2 release cycle.

Fixes #46141. See #44458, #45932, #45940, #46038, #46047, #46068.


git-svn-id: https://develop.svn.wordpress.org/trunk@44717 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz
2019-01-30 11:00:30 +00:00
parent a95cec1fe8
commit 0612ea2d38
16 changed files with 10 additions and 1298 deletions
@@ -40,7 +40,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
);
$status = 'all';
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused' ) ) ) {
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) {
$status = $_REQUEST['plugin_status'];
}
@@ -99,7 +99,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
'upgrade' => array(),
'mustuse' => array(),
'dropins' => array(),
'paused' => array(),
);
$screen = $this->screen;
@@ -210,9 +209,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( $show_network_active ) {
// On the non-network screen, show network-active plugins if allowed
$plugins['active'][ $plugin_file ] = $plugin_data;
if ( is_plugin_paused( $plugin_file ) ) {
$plugins['paused'][ $plugin_file ] = $plugin_data;
}
} else {
// On the non-network screen, filter out network-active plugins
unset( $plugins['all'][ $plugin_file ] );
@@ -222,9 +218,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
// On the non-network screen, populate the active list with plugins that are individually activated
// On the network-admin screen, populate the active list with plugins that are network activated
$plugins['active'][ $plugin_file ] = $plugin_data;
if ( is_plugin_paused( $plugin_file ) ) {
$plugins['paused'][ $plugin_file ] = $plugin_data;
}
} else {
if ( isset( $recently_activated[ $plugin_file ] ) ) {
// Populate the recently activated list with plugins that have been recently activated
@@ -452,10 +445,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
/* translators: %s: plugin count */
$text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
break;
case 'paused':
/* translators: %s: plugin count */
$text = _n( 'Paused <span class="count">(%s)</span>', 'Paused <span class="count">(%s)</span>', $count );
break;
case 'upgrade':
/* translators: %s: plugin count */
$text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count );
@@ -644,19 +633,11 @@ class WP_Plugins_List_Table extends WP_List_Table {
/* translators: %s: plugin name */
$actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>';
}
if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Resume' ) . '</a>';
}
} else {
if ( current_user_can( 'manage_network_plugins' ) ) {
/* translators: %s: plugin name */
$actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>';
}
if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Resume' ) . '</a>';
}
if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
@@ -667,10 +648,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
$actions = array(
'network_active' => __( 'Network Active' ),
);
if ( ! $restrict_network_only && current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>';
}
} elseif ( $restrict_network_only ) {
$actions = array(
'network_only' => __( 'Network Only' ),
@@ -680,10 +657,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
/* translators: %s: plugin name */
$actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
}
if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>';
}
} else {
if ( current_user_can( 'activate_plugin', $plugin_file ) ) {
/* translators: %s: plugin name */
@@ -791,12 +764,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
$class .= ' update';
}
$paused = is_plugin_paused( $plugin_file );
$paused_on_network_sites_count = $screen->in_admin( 'network' ) ? count_paused_plugin_sites_for_network( $plugin_file ) : 0;
if ( $paused || $paused_on_network_sites_count ) {
$class .= ' paused';
}
$plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name );
printf(
'<tr class="%s" data-slug="%s" data-plugin="%s">',
@@ -878,53 +845,13 @@ class WP_Plugins_List_Table extends WP_List_Table {
* @param array $plugin_data An array of plugin data.
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
* 'Drop-ins', 'Search', 'Paused'.
* 'Drop-ins', 'Search'.
*/
$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
echo implode( ' | ', $plugin_meta );
echo '</div>';
if ( $paused || $paused_on_network_sites_count ) {
$notice_text = __( 'This plugin failed to load properly and was paused within the admin backend.' );
if ( $screen->in_admin( 'network' ) && $paused_on_network_sites_count ) {
$notice_text = sprintf(
/* translators: %s: number of sites */
_n( 'This plugin failed to load properly and was paused within the admin backend for %s site.', 'This plugin failed to load properly and was paused within the admin backend for %s sites.', $paused_on_network_sites_count ),
number_format_i18n( $paused_on_network_sites_count )
);
}
printf( '<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text );
$error = wp_get_plugin_error( $plugin_file );
if ( false !== $error ) {
$constants = get_defined_constants( true );
$constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal'];
foreach ( $constants as $constant => $value ) {
if ( 0 === strpos( $constant, 'E_' ) ) {
$core_errors[ $value ] = $constant;
}
}
$error['type'] = $core_errors[ $error['type'] ];
printf(
'<div class="error-display"><p>%s</p></div>',
sprintf(
/* translators: 1: error type, 2: error line number, 3: error file name, 4: error message */
__( 'The plugin caused an error of type %1$s in line %2$s of the file %3$s. Error message: %4$s' ),
"<code>{$error['type']}</code>",
"<code>{$error['line']}</code>",
"<code>{$error['file']}</code>",
"<code>{$error['message']}</code>"
)
);
}
}
echo '</td>';
break;
default:
@@ -958,7 +885,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
* @param array $plugin_data An array of plugin data.
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
* 'Drop-ins', 'Search', 'Paused'.
* 'Drop-ins', 'Search'.
*/
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
@@ -974,7 +901,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
* @param array $plugin_data An array of plugin data.
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
* 'Drop-ins', 'Search', 'Paused'.
* 'Drop-ins', 'Search'.
*/
do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
}