Ticket #20241: wptrac20241_allow_plugin_to_register_other_plugins_v3.patch
File wptrac20241_allow_plugin_to_register_other_plugins_v3.patch, 2.5 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/plugin.php
522 522 do_action( 'activate_plugin', $plugin, $network_wide ); 523 523 do_action( 'activate_' . $plugin, $network_wide ); 524 524 } 525 526 525 if ( $network_wide ) { 526 // Check active_plugins again - the activated plugin may have activated 527 // other plugins during activation. 528 $current = get_site_option( 'active_sitewide_plugins', array() ); 527 529 $current[$plugin] = time(); 528 530 update_site_option( 'active_sitewide_plugins', $current ); 529 531 } else { 532 // Check active_sitewide_plugins again - the activated plugin may have 533 // activated other plugins during activation. 534 $current = get_option( 'active_plugins', array() ); 530 535 $current[] = $plugin; 531 536 sort($current); 532 537 update_option('active_plugins', $current); … … 558 563 * @param bool $silent Prevent calling deactivation hooks. Default is false. 559 564 */ 560 565 function deactivate_plugins( $plugins, $silent = false ) { 561 if ( is_multisite() )562 $network_current = get_site_option( 'active_sitewide_plugins', array() );563 $current = get_option( 'active_plugins', array() );564 566 $do_blog = $do_network = false; 565 567 566 568 foreach ( (array) $plugins as $plugin ) { … … 570 572 571 573 $network_wide = is_plugin_active_for_network( $plugin ); 572 574 573 if ( ! $silent ) 575 if ( ! $silent ) { 574 576 do_action( 'deactivate_plugin', $plugin, $network_wide ); 577 do_action( 'deactivate_' . $plugin, $network_wide ); 578 do_action( 'deactivated_plugin', $plugin, $network_wide ); 579 } 580 581 // Check active plugins now, not earlier - the activated plugin may have 582 // deactivated other plugins during deactivation. 583 if ( is_multisite() ) 584 $network_current = get_site_option( 'active_sitewide_plugins', array() ); 585 $current = get_option( 'active_plugins', array() ); 575 586 576 587 if ( $network_wide ) { 577 588 $do_network = true; … … 583 594 array_splice( $current, $key, 1 ); 584 595 } 585 596 } 586 587 if ( ! $silent ) {588 do_action( 'deactivate_' . $plugin, $network_wide);589 do_action( 'deactivated_plugin', $plugin, $network_wide );590 }597 598 if ( $do_blog ) 599 update_option('active_plugins', $current); 600 if ( $do_network ) 601 update_site_option( 'active_sitewide_plugins', $network_current ); 591 602 } 592 593 if ( $do_blog )594 update_option('active_plugins', $current);595 if ( $do_network )596 update_site_option( 'active_sitewide_plugins', $network_current );597 603 } 598 604 599 605 /**