PluginProbe
The Innovative Form Builder – IvyForms / 0.8
The Innovative Form Builder – IvyForms v0.8
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 1.2 1.3
ivyforms / backend / src / Services / InstallActions / DeletionMultisite.php

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

47 lines 1006 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 use IvyForms\Common\Exceptions\InvalidArgumentException;
15
16 /**
17 * Class DeletionMultisite
18 *
19 * @package IvyForms\Services\InstallActions
20 */
21 class DeletionMultisite
22 {
23 /**
24 * Delete the plugin tables for every sub-site separately
25 * @throws InvalidArgumentException
26 */
27 public static function delete(): void
28 {
29 global $wpdb;
30
31 // Get current blog id
32 $oldSite = $wpdb->blogid;
33 // Get all blog ids
34 $siteIds = $wpdb->get_col(
35 $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs")
36 );
37
38 foreach ($siteIds as $siteId) {
39 switch_to_blog($siteId);
40 // Delete database tables if exists
41 DeleteDatabaseHook::delete();
42 }
43 // Returns to current blog
44 switch_to_blog($oldSite);
45 }
46 }
47