Your IP : 216.73.216.215


Current Path : /home/flapst5/ekmtoronto.com/wp-content/plugins/wp-defender/src/
Upload File :
Current File : /home/flapst5/ekmtoronto.com/wp-content/plugins/wp-defender/src/class-bootstrap.php

<?php
/**
 * Bootstrap for WP Defender.
 *
 * @package WP_Defender
 */

namespace WP_Defender;

use WP_Defender\Traits\Defender_Bootstrap;

/**
 * Class Bootstrap
 */
class Bootstrap {

	use Defender_Bootstrap;

	/**
	 * Activation.
	 */
	public function activation_hook(): void {
		$this->activation_hook_common();
		$this->create_database_tables();
	}

	/**
	 * Creates the necessary database tables for Pro version.
	 *
	 * @return void
	 */
	public function create_database_tables(): void {
		$this->create_table_quarantine();
		// Set flag to indicate pro tables have been created.
		update_site_option( 'wd_pro_tables_created', true );
	}

	/**
	 * Deactivation - clears all cron hooks including pro-only ones.
	 */
	public function deactivation_hook(): void {
		$this->deactivation_hook_common();

		// Pro-only cron hooks.
		wp_clear_scheduled_hook( 'audit_sync_events' );
		wp_clear_scheduled_hook( 'audit_clean_up_logs' );
		wp_clear_scheduled_hook( 'wpdef_quarantine_delete_expired' );

		// Remove old legacy pro-only cron jobs if they exist.
		wp_clear_scheduled_hook( 'auditReportCron' );
	}

	/**
	 * Load all modules.
	 *
	 * Registers a one-time post-activation redirect check on `admin_init` so
	 * activation setup can complete before any redirect happens.
	 *
	 * @return void
	 */
	public function init_modules(): void {
		add_action( 'admin_init', array( $this, 'maybe_redirect_after_activation' ), 1 );
		$this->init_modules_common();
	}
}