From f7bf2c25ace8dc257559e68eae181c9b05a04556 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 25 Jan 2007 20:45:20 +0000 Subject: [PATCH] Prevent plugins that generate PHP fatal errors from being activated. ticket #3254 git-svn-id: http://svn.automattic.com/wordpress/trunk@4811 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/plugins.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 94d461d3e5..25d320fb84 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -11,13 +11,14 @@ if ( isset($_GET['action']) ) { if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) wp_die(__('Plugin file does not exist.')); if (!in_array($plugin, $current)) { + wp_redirect('plugins.php?error=true'); // we'll override this later if the plugin can be included without fatal error + @include(ABSPATH . PLUGINDIR . '/' . $plugin); $current[] = $plugin; sort($current); update_option('active_plugins', $current); - include(ABSPATH . PLUGINDIR . '/' . $plugin); do_action('activate_' . $plugin); } - wp_redirect('plugins.php?activate=true'); + wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above } else if ('deactivate' == $_GET['action']) { check_admin_referer('deactivate-plugin_' . $_GET['plugin']); $current = get_option('active_plugins'); @@ -58,13 +59,12 @@ foreach ($check_plugins as $check_plugin) { } ?> - -

activated.') ?>

-
- - -

deactivated.') ?>

-
+ +

fatal error.') ?>

+ +

activated.') ?>

+ +

deactivated.') ?>