# patchstack/2.3.1/includes/mu-plugin.php

Patchstack – WordPress &amp; Plugins Security, version 2.3.1. 53 lines.

- Page: https://pluginprobe.com/plugins/patchstack/2.3.1/code/includes/mu-plugin.php
- Raw: https://pluginprobe.com/plugins/patchstack/2.3.1/raw/includes/mu-plugin.php
- Modified: 2025-03-24T12:30:02+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/patchstack/2.3.1/code/includes/mu-plugin.php#L10-L20`.

```php
<?php

// Do not allow the file to be called directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// Do not run if already executed.
if ( defined( 'PS_FW_MU_RAN' ) ) {
    return;
}

// Do not run if we're not supposed to.
if ( get_option( 'patchstack_license_activated', 0 ) == 0 || get_option( 'patchstack_basic_firewall', 0 ) != 1 || get_option( 'patchstack_license_free', 0 ) == 1 ) {
    return;
}

// Load essential WP core file.
require_once ABSPATH . 'wp-admin/includes/plugin.php';

// Determine if the Patchstack plugin folder exists.
$pluginDir = WP_PLUGIN_DIR . '/patchstack';
if ( ! is_dir( $pluginDir ) || ! is_plugin_active( 'patchstack/patchstack.php' ) ) {
    return;
}

// Determine if the core file exists.
if ( ! file_exists( $pluginDir . '/includes/core.php' ) || ! file_exists( $pluginDir . '/includes/firewall.php' ) ) {
    return;
}

// Make sure to load essential files.
if ( ! class_exists( 'P_Firewall' ) || ! class_exists( 'P_Core' ) ) {
    // Require the core and firewall files.
    require_once $pluginDir . '/includes/core.php';
    require_once $pluginDir . '/includes/firewall.php';

    // For rare situations where it did not load properly.
    if ( ! class_exists( 'P_Firewall' ) || ! class_exists( 'P_Core' ) ) {
        return;
    }
}

// Initialize and launch.
try {
    $core = new P_Core( null );
    new P_Firewall( true, $core, false, true );
} catch (\Exception $e) {
    //
}

define( 'PS_FW_MU_RAN', true );

```
