Changeset 16012
- Timestamp:
- 10/27/2010 01:40:14 PM (14 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/plugin.php
r16011 r16012 461 461 * @param string $plugin Plugin path to main plugin file with plugin data. 462 462 * @param string $redirect Optional. URL to redirect to. 463 * @param bool $network_wide Whether to enable the plugin for all sites in the network or just the current site. Multisite only. Default is false. 463 * @param bool $network_wide Whether to enable the plugin for all sites in the 464 * network or just the current site. Multisite only. Default is false. 465 * @param bool $silent Prevent calling activation hooks. Optional, default is false. 464 466 * @return WP_Error|null WP_Error on invalid file or null on success. 465 467 */ 466 function activate_plugin( $plugin, $redirect = '', $network_wide = false ) {468 function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) { 467 469 $plugin = plugin_basename( trim( $plugin ) ); 468 470 … … 483 485 ob_start(); 484 486 include(WP_PLUGIN_DIR . '/' . $plugin); 485 do_action( 'activate_plugin', $plugin, $network_wide ); 486 do_action( 'activate_' . $plugin, $network_wide ); 487 488 if ( ! $silent ) { 489 do_action( 'activate_plugin', $plugin, $network_wide ); 490 do_action( 'activate_' . $plugin, $network_wide ); 491 } 492 487 493 if ( $network_wide ) { 488 494 $current[$plugin] = time(); … … 493 499 update_option('active_plugins', $current); 494 500 } 495 do_action( 'activated_plugin', $plugin, $network_wide ); 501 502 if ( ! $silent ) { 503 do_action( 'activated_plugin', $plugin, $network_wide ); 504 } 505 496 506 if ( ob_get_length() > 0 ) { 497 507 $output = ob_get_clean(); … … 513 523 * 514 524 * @param string|array $plugins Single plugin or list of plugins to deactivate. 515 * @param bool $silent Optional, default is false. Prevent calling deactivate hook.525 * @param bool $silent Prevent calling deactivation hooks. Default is false. 516 526 */ 517 527 function deactivate_plugins( $plugins, $silent = false ) { … … 567 577 * @param string $redirect Redirect to page after successful activation. 568 578 * @param bool $network_wide Whether to enable the plugin for all sites in the network. 579 * @param bool $silent Prevent calling activation hooks. Default is false. 569 580 * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation. 570 581 */ 571 function activate_plugins( $plugins, $redirect = '', $network_wide) {582 function activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false ) { 572 583 if ( !is_array($plugins) ) 573 584 $plugins = array($plugins); 574 585 575 586 $errors = array(); 576 foreach ( (array)$plugins as $plugin ) {587 foreach ( $plugins as $plugin ) { 577 588 if ( !empty($redirect) ) 578 589 $redirect = add_query_arg('plugin', $plugin, $redirect); 579 $result = activate_plugin($plugin, $redirect, $network_wide );590 $result = activate_plugin($plugin, $redirect, $network_wide, $silent); 580 591 if ( is_wp_error($result) ) 581 592 $errors[$plugin] = $result; -
trunk/wp-admin/update.php
r16008 r16012 72 72 if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) { 73 73 wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']) ); 74 activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ) );74 activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true ); 75 75 wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']) ); 76 76 die();
Note: See TracChangeset
for help on using the changeset viewer.