Ticket #20241: allow_plugin_to_register_other_plugins.patch
File allow_plugin_to_register_other_plugins.patch, 1.9 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(); … … 560 564 function deactivate_plugins( $plugins, $silent = false ) { 561 565 if ( is_multisite() ) 562 566 $network_current = get_site_option( 'active_sitewide_plugins', array() ); 563 $current = get_option( 'active_plugins', array() );564 567 $do_blog = $do_network = false; 565 568 566 569 foreach ( (array) $plugins as $plugin ) { … … 573 576 if ( ! $silent ) 574 577 do_action( 'deactivate_plugin', $plugin, $network_wide ); 575 578 579 if ( ! $silent ) { 580 do_action( 'deactivate_' . $plugin, $network_wide ); 581 do_action( 'deactivated_plugin', $plugin, $network_wide ); 582 } 583 584 // Check active_plugins now, not earlier - the activated plugin may have 585 // deactivated other plugins during deactivation. 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 /**