| @@ -25,8 +25,9 @@ | ||
| 25 | 25 | // Retrieve all site IDs from this network (WordPress >= 4.6 provides easy to use functions for that). |
| 26 | 26 | if ( function_exists( 'get_sites' ) && function_exists( 'get_current_network_id' ) ) { |
| 27 | 27 | $site_ids = get_sites( array( 'fields' => 'ids', 'network_id' => get_current_network_id() ) ); |
| 28 | 28 | } else { |
| 29 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Retrieving site IDs for multisite migration | |
| 29 | 30 | $site_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = $wpdb->siteid;" ); |
| 30 | 31 | } |
| 31 | 32 | // Install the plugin for all these sites. |
| 32 | 33 | foreach ( $site_ids as $site_id ) { |
| @@ -52,6 +53,17 @@ | ||
| 52 | 53 | RelationMigrator::migrate($isForced); |
| 53 | 54 | CommentsMigrator::migrate($isForced); |
| 54 | 55 | AttachmentMigrator::migrate($isForced); |
| 55 | 56 | TeamMigrator::migrate($isForced); |
| 57 | + } | |
| 58 | + | |
| 59 | + public static function handle_new_site($new_site) | |
| 60 | + { | |
| 61 | + if (!is_plugin_active_for_network('fluent-boards/fluent-boards.php')) { | |
| 62 | + return; | |
| 63 | + } | |
| 64 | + | |
| 65 | + switch_to_blog($new_site->blog_id); | |
| 66 | + self::migrate(false); | |
| 67 | + restore_current_blog(); | |
| 56 | 68 | } |
| 57 | 69 | } |