use activate_plugin for error scraping, pass full WP_Error object to wp_die(), whitespace cleanups. Props DD32. fixes #7671

git-svn-id: https://develop.svn.wordpress.org/trunk@9315 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-10-24 05:47:55 +00:00
parent 70fc9ebcb4
commit 13897aba80
1 changed files with 23 additions and 21 deletions

View File

@ -28,7 +28,7 @@ if( !empty($action) ) {
check_admin_referer('activate-plugin_' . $plugin); check_admin_referer('activate-plugin_' . $plugin);
$result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin); $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
if ( is_wp_error( $result ) ) if ( is_wp_error( $result ) )
wp_die( $result->get_error_message() ); wp_die($result);
$recent = (array)get_option('recently_activated'); $recent = (array)get_option('recently_activated');
if ( isset($recent[ $plugin ]) ) { if ( isset($recent[ $plugin ]) ) {
unset($recent[ $plugin ]); unset($recent[ $plugin ]);
@ -59,7 +59,9 @@ if( !empty($action) ) {
wp_die($valid); wp_die($valid);
error_reporting( E_ALL ^ E_NOTICE ); error_reporting( E_ALL ^ E_NOTICE );
@ini_set('display_errors', true); //Ensure that Fatal errors are displayed. @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
include(WP_PLUGIN_DIR . '/' . $plugin); $result = activate_plugin($plugin, false);
if ( is_wp_error( $result ) )
wp_die($result);
exit; exit;
break; break;
case 'deactivate': case 'deactivate':