| 592 | |
| 593 | if ( $network_wide ) { |
| 594 | /** |
| 595 | * Fires as a specific plugin is being activated for a network. |
| 596 | * |
| 597 | * This hook is the "activation" hook used internally by register_activation_hook(). |
| 598 | * The dynamic portion of the hook name, `$plugin`, refers to the plugin basename. |
| 599 | * |
| 600 | * If a plugin is silently activated (such as during an update), this hook does not fire. |
| 601 | * |
| 602 | * @since 4.7.0 |
| 603 | */ |
| 604 | do_action( 'activate_' . $plugin . '_for_network' ); |
| 605 | |
| 606 | if ( has_action( 'activate_' . $plugin . '_for_site' ) && ! wp_is_large_network( 'sites' ) ) { |
| 607 | $site_ids = get_sites( array( 'fields' => 'ids', 'network_id' => get_network()->id ) ); |
| 608 | |
| 609 | foreach ( $site_ids as $site_id ) { |
| 610 | switch_to_blog( $site_id ); |
| 611 | |
| 612 | /** |
| 613 | * Fires as a specific plugin is being activated for a site. |
| 614 | * |
| 615 | * This hook is the "activation" hook used internally by register_activation_hook(). |
| 616 | * The dynamic portion of the hook name, `$plugin`, refers to the plugin basename. |
| 617 | * |
| 618 | * If a plugin is silently activated (such as during an update), this hook does not fire. |
| 619 | * |
| 620 | * @since 4.7.0 |
| 621 | */ |
| 622 | do_action( 'activate_' . $plugin . '_for_site' ); |
| 623 | |
| 624 | restore_current_blog(); |
| 625 | } |
| 626 | } |
| 627 | } else { |
| 628 | /** This action is documented in wp-admin/includes/plugin.php */ |
| 629 | do_action( 'activate_' . $plugin . '_for_site' ); |
| 630 | } |