PluginProbe
The Innovative Form Builder – IvyForms / 0.2
The Innovative Form Builder – IvyForms v0.2
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / InstallActions / ActivationMultisite.php

ActivationMultisite.php in The Innovative Form Builder – IvyForms 0.2, at backend/src/Services/InstallActions/ActivationMultisite.php

44 lines 909 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Network activation
5 */
6
7 namespace IvyForms\Services\InstallActions;
8
9 // phpcs:disable PSR1.Files.SideEffects
10 if (!defined('ABSPATH')) {
11 exit; // Exit if accessed directly
12 }
13
14 /**
15 * Class ActivationMultisite
16 *
17 * @package IvyForms\Services\InstallActions
18 */
19 class ActivationMultisite
20 {
21 /**
22 * Activate the plugin for every sub-site separately
23 */
24 public static function init(): void
25 {
26 global $wpdb;
27
28 // Get current blog id
29 $oldSite = $wpdb->blogid;
30 // Get all blog ids
31 $siteIds = $wpdb->get_col(
32 $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs")
33 );
34
35 foreach ($siteIds as $siteId) {
36 switch_to_blog($siteId);
37 // Create database table if not exists
38 ActivationDatabaseHook::init();
39 }
40 // Returns to current blog
41 switch_to_blog($oldSite);
42 }
43 }
44