Ticket #20241: allow_plugin_to_register_other_plugins_v2.patch
File allow_plugin_to_register_other_plugins_v2.patch, 2.1 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 // Check active_plugins again - the activated plugin may have activated 527 // other plugins during activation. 528 $current = get_option( 'active_plugins', array() ); 525 529 526 530 if ( $network_wide ) { 527 531 $current[$plugin] = time(); … … 558 562 * @param bool $silent Prevent calling deactivation hooks. Default is false. 559 563 */ 560 564 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 565 $do_blog = $do_network = false; 565 566 566 567 foreach ( (array) $plugins as $plugin ) { … … 573 574 if ( ! $silent ) 574 575 do_action( 'deactivate_plugin', $plugin, $network_wide ); 575 576 577 if ( ! $silent ) { 578 do_action( 'deactivate_' . $plugin, $network_wide ); 579 do_action( 'deactivated_plugin', $plugin, $network_wide ); 580 } 581 582 // Check active plugins now, not earlier - the activated plugin may have 583 // deactivated other plugins during deactivation. 584 if ( is_multisite() ) 585 $network_current = get_site_option( 'active_sitewide_plugins', array() ); 586 $current = get_option( 'active_plugins', array() ); 587 576 588 if ( $network_wide ) { 577 589 $do_network = true; 578 590 unset( $network_current[ $plugin ] ); … … 583 595 array_splice( $current, $key, 1 ); 584 596 } 585 597 } 586 587 if ( ! $silent ) {588 do_action( 'deactivate_' . $plugin, $network_wide);589 do_action( 'deactivated_plugin', $plugin, $network_wide );590 }598 599 if ( $do_blog ) 600 update_option('active_plugins', $current); 601 if ( $do_network ) 602 update_site_option( 'active_sitewide_plugins', $network_current ); 591 603 } 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 604 } 598 605 599 606 /**