@@ -59,24 +59,46 @@ public static function init() {
59
59
60
60
/**
61
61
* Activation Hook.
62
+ *
63
+ * @param bool $network_wide Whether to activate the plugin for all sites in the network or just the current site.
62
64
*/
63
- public static function activate () {
65
+ public static function activate ( $ network_wide ) {
64
66
self ::flush_rewrite_rules ();
65
67
Scheduler::register_schedules ();
66
68
67
69
\add_filter ( 'pre_wp_update_comment_count_now ' , array ( Comment::class, 'pre_wp_update_comment_count_now ' ), 10 , 3 );
68
70
Migration::update_comment_counts ();
71
+
72
+ if ( \is_multisite () && $ network_wide && ! \wp_is_large_network () ) {
73
+ $ sites = \get_sites ( array ( 'fields ' => 'ids ' ) );
74
+ foreach ( $ sites as $ site ) {
75
+ \switch_to_blog ( $ site );
76
+ self ::flush_rewrite_rules ();
77
+ \restore_current_blog ();
78
+ }
79
+ }
69
80
}
70
81
71
82
/**
72
83
* Deactivation Hook.
84
+ *
85
+ * @param bool $network_wide Whether to deactivate the plugin for all sites in the network or just the current site.
73
86
*/
74
- public static function deactivate () {
87
+ public static function deactivate ( $ network_wide ) {
75
88
self ::flush_rewrite_rules ();
76
89
Scheduler::deregister_schedules ();
77
90
78
91
\remove_filter ( 'pre_wp_update_comment_count_now ' , array ( Comment::class, 'pre_wp_update_comment_count_now ' ) );
79
92
Migration::update_comment_counts ( 2000 );
93
+
94
+ if ( \is_multisite () && $ network_wide && ! \wp_is_large_network () ) {
95
+ $ sites = \get_sites ( array ( 'fields ' => 'ids ' ) );
96
+ foreach ( $ sites as $ site ) {
97
+ \switch_to_blog ( $ site );
98
+ self ::flush_rewrite_rules ();
99
+ \restore_current_blog ();
100
+ }
101
+ }
80
102
}
81
103
82
104
/**
0 commit comments