<?php
/**
 * Deactivation handler.
 *
 * @package SubmissionInbox
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

require_once __DIR__ . '/Lifecycle/SiteProvisioner.php';

/**
 * Handles plugin deactivation.
 */
class SUBIN_Deactivator {
	/**
	 * Stop workers for one site or every network site.
	 *
	 * @param bool $network_wide Whether deactivation is network-wide.
	 * @return void
	 */
	public static function deactivate( $network_wide = false ) {
		if ( is_multisite() && $network_wide ) {
			\SUBIN\Lifecycle\SiteProvisioner::for_each_site(
				array( '\SUBIN\Lifecycle\SiteProvisioner', 'deactivate_current_site' )
			);

			return;
		}

		\SUBIN\Lifecycle\SiteProvisioner::deactivate_current_site();
	}
}
