PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.1
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 / DeletionMultisite.php

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

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