# ivyforms/0.6/backend/src/Services/InstallActions/DeletionMultisite.php

The Innovative Form Builder – IvyForms, version 0.6. 47 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/0.6/code/backend/src/Services/InstallActions/DeletionMultisite.php
- Raw: https://pluginprobe.com/plugins/ivyforms/0.6/raw/backend/src/Services/InstallActions/DeletionMultisite.php
- Modified: 2025-11-19T18:42:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/0.6/code/backend/src/Services/InstallActions/DeletionMultisite.php#L10-L20`.

```php
<?php

/**
 * Network activation
 */

namespace  IvyForms\Services\InstallActions;

// phpcs:disable PSR1.Files.SideEffects
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

use IvyForms\Common\Exceptions\InvalidArgumentException;

/**
 * Class DeletionMultisite
 *
 * @package IvyForms\Services\InstallActions
 */
class DeletionMultisite
{
    /**
     * Delete the plugin tables for every sub-site separately
     * @throws InvalidArgumentException
     */
    public static function delete(): void
    {
        global $wpdb;

        // Get current blog id
        $oldSite = $wpdb->blogid;
        // Get all blog ids
        $siteIds = $wpdb->get_col(
            $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs")
        );

        foreach ($siteIds as $siteId) {
            switch_to_blog($siteId);
            // Delete database tables if exists
            DeleteDatabaseHook::delete();
        }
        // Returns to current blog
        switch_to_blog($oldSite);
    }
}

```
