From 2fd0094ce3f649df7892ee6bb11d01c8badea2ed Mon Sep 17 00:00:00 2001 From: markjaquith Date: Mon, 25 Jun 2007 18:57:54 +0000 Subject: [PATCH] Display fatal errors that prevent plugins from being activated. fixes #4508 git-svn-id: http://svn.automattic.com/wordpress/trunk@5753 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/plugins.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 91d52c113..8c282eaee 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -11,7 +11,7 @@ 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 + wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error ob_start(); @include(ABSPATH . PLUGINDIR . '/' . $plugin); $current[] = $plugin; @@ -21,7 +21,15 @@ if ( isset($_GET['action']) ) { ob_end_clean(); } wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above - } else if ('deactivate' == $_GET['action']) { + } elseif ('error_scrape' == $_GET['action']) { + $plugin = trim($_GET['plugin']); + check_admin_referer('plugin-activation-error_' . $plugin); + if ( validate_file($plugin) ) + wp_die(__('Invalid plugin.')); + if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) + wp_die(__('Plugin file does not exist.')); + include(ABSPATH . PLUGINDIR . '/' . $plugin); + } elseif ('deactivate' == $_GET['action']) { check_admin_referer('deactivate-plugin_' . $_GET['plugin']); $current = get_option('active_plugins'); array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu! @@ -73,7 +81,15 @@ foreach ($check_plugins as $check_plugin) { ?> -

fatal error.') ?>

+

fatal error.') ?>

+ + + +

activated.') ?>