Ticket #14170: 14170.diff
File 14170.diff, 2.9 KB (added by , 14 years ago) |
---|
-
wp-includes/plugin.php
605 605 */ 606 606 function register_activation_hook($file, $function) { 607 607 $file = plugin_basename($file); 608 add_action('activate_' . $file, $function );608 add_action('activate_' . $file, $function, 10, 2); 609 609 } 610 610 611 611 /** … … 630 630 */ 631 631 function register_deactivation_hook($file, $function) { 632 632 $file = plugin_basename($file); 633 add_action('deactivate_' . $file, $function );633 add_action('deactivate_' . $file, $function, 10, 2); 634 634 } 635 635 636 636 /** -
wp-admin/includes/plugin.php
482 482 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 483 483 ob_start(); 484 484 include(WP_PLUGIN_DIR . '/' . $plugin); 485 do_action( 'activate_plugin', trim( $plugin) );486 do_action( 'activate_' . trim( $plugin ) );485 do_action( 'activate_plugin', trim( $plugin), $network_wide ); 486 do_action( 'activate_' . trim( $plugin ), $network_wide ); 487 487 if ( $network_wide ) { 488 488 $current[$plugin] = time(); 489 489 update_site_option( 'active_sitewide_plugins', $current ); … … 492 492 sort($current); 493 493 update_option('active_plugins', $current); 494 494 } 495 do_action( 'activated_plugin', trim( $plugin) );495 do_action( 'activated_plugin', trim( $plugin), $network_wide ); 496 496 if ( ob_get_length() > 0 ) { 497 497 $output = ob_get_clean(); 498 498 return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output); … … 524 524 $plugin = plugin_basename($plugin); 525 525 if ( ! is_plugin_active($plugin) ) 526 526 continue; 527 528 $network_wide = is_plugin_active_for_network( $plugin ); 529 527 530 if ( ! $silent ) 528 do_action( 'deactivate_plugin', trim( $plugin ) );531 do_action( 'deactivate_plugin', trim( $plugin ), $network_wide ); 529 532 530 if ( is_plugin_active_for_network($plugin) ) { 531 // Deactivate network wide 533 if ( $network_wide ) { 532 534 $do_network = true; 533 535 unset( $network_current[ $plugin ] ); 534 536 } else { 535 // Deactivate for this blog only536 537 $key = array_search( $plugin, (array) $current ); 537 538 if ( false !== $key ) { 538 539 $do_blog = true; … … 540 541 } 541 542 } 542 543 543 //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output.544 544 if ( ! $silent ) { 545 do_action( 'deactivate_' . trim( $plugin ) );546 do_action( 'deactivated_plugin', trim( $plugin ) );545 do_action( 'deactivate_' . trim( $plugin ), $network_wide ); 546 do_action( 'deactivated_plugin', trim( $plugin ), $network_wide ); 547 547 } 548 548 } 549 549