mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-23 23:04:25 +00:00
Detect plugin output on activation, as well as fatal errors. props miqrogroove. fixes #12089
git-svn-id: https://develop.svn.wordpress.org/trunk@13167 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -358,7 +358,11 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
|
||||
if ( !empty($redirect) )
|
||||
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
|
||||
ob_start();
|
||||
@include(WP_PLUGIN_DIR . '/' . $plugin);
|
||||
include(WP_PLUGIN_DIR . '/' . $plugin);
|
||||
if ( ob_get_length() > 0 ) {
|
||||
$output = ob_get_clean();
|
||||
return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);
|
||||
}
|
||||
do_action( 'activate_plugin', trim( $plugin) );
|
||||
if ( $network_wide ) {
|
||||
$current[$plugin] = time();
|
||||
|
||||
Reference in New Issue
Block a user