| @@ -7,9 +7,11 @@ | ||
| 7 | 7 | * Author: MainWP |
| 8 | 8 | * Author URI: https://mainwp.com |
| 9 | 9 | * Plugin URI: https://mainwp.com/ |
| 10 | 10 | * Text Domain: mainwp |
| 11 | - * Version: 5.2 | |
| 11 | + * Version: 6.2 | |
| 12 | + * License: GPLv3 or later | |
| 13 | + * License URI: https://www.gnu.org/licenses/gpl-3.0.html | |
| 12 | 14 | * |
| 13 | 15 | * @package MainWP/Dashboard |
| 14 | 16 | * |
| 15 | 17 | * @uses \MainWP\Dashboard\MainWP_System |
| @@ -14,8 +16,26 @@ | ||
| 14 | 16 | * |
| 15 | 17 | * @uses \MainWP\Dashboard\MainWP_System |
| 16 | 18 | */ |
| 17 | 19 | |
| 20 | +// Exit if accessed directly. | |
| 21 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 22 | + exit; | |
| 23 | +} | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * Ignore cron/bootstrap.php from Plugin Check direct file access protection. | |
| 27 | + * This file must execute before WordPress loads to locate wp-load.php, | |
| 28 | + * so the standard ABSPATH check would break functionality. | |
| 29 | + */ | |
| 30 | +add_filter( | |
| 31 | + 'wp_plugin_check_ignore_files', | |
| 32 | + function ( $ignored_files ) { | |
| 33 | + $ignored_files[] = 'cron/bootstrap.php'; | |
| 34 | + return $ignored_files; | |
| 35 | + } | |
| 36 | +); | |
| 37 | + | |
| 18 | 38 | if ( ! defined( 'MAINWP_PLUGIN_FILE' ) ) { |
| 19 | 39 | |
| 20 | 40 | /** |
| 21 | 41 | * Define MainWP Dashboard Plugin absolute full path and filename of this file. |
| @@ -118,8 +138,36 @@ | ||
| 118 | 138 | require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'core-functions.php'; // NOSONAR -- WP compatible. |
| 119 | 139 | require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'compatible.php'; // NOSONAR -- WP compatible. |
| 120 | 140 | require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'class-mainwp-includes.php'; // NOSONAR -- WP compatible. |
| 121 | 141 | |
| 142 | +// Load Abilities API integration (feature-gated). | |
| 143 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities-util.php'; // NOSONAR -- WP compatible. | |
| 144 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities-sites.php'; // NOSONAR -- WP compatible. | |
| 145 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities-updates.php'; // NOSONAR -- WP compatible. | |
| 146 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities-clients.php'; // NOSONAR -- WP compatible. | |
| 147 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities-tags.php'; // NOSONAR -- WP compatible. | |
| 148 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities-batch.php'; // NOSONAR -- WP compatible. | |
| 149 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities-cron.php'; // NOSONAR -- WP compatible. | |
| 150 | +require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'abilities' . DIRECTORY_SEPARATOR . 'class-mainwp-abilities.php'; // NOSONAR -- WP compatible. | |
| 151 | + | |
| 152 | +// Initialize Abilities API integration (does nothing if Abilities API not available). | |
| 153 | +if ( class_exists( '\MainWP\Dashboard\MainWP_Abilities' ) ) { | |
| 154 | + \MainWP\Dashboard\MainWP_Abilities::init(); | |
| 155 | +} | |
| 156 | + | |
| 157 | +if ( file_exists( MAINWP_PLUGIN_DIR . 'modules/system-monitor/bootstrap.php' ) ) { | |
| 158 | + define( 'MAINWP_SYSTEM_MONITOR_FILE', __FILE__ ); | |
| 159 | + require_once MAINWP_PLUGIN_DIR . 'modules/system-monitor/bootstrap.php'; // NOSONAR - WP compatible. | |
| 160 | + register_activation_hook( | |
| 161 | + MAINWP_SYSTEM_MONITOR_FILE, | |
| 162 | + array( MainWP\Dashboard\SystemMonitor\MainWP_System_Monitor::class, 'activate' ) | |
| 163 | + ); | |
| 164 | + register_deactivation_hook( | |
| 165 | + MAINWP_SYSTEM_MONITOR_FILE, | |
| 166 | + array( MainWP\Dashboard\SystemMonitor\MainWP_System_Monitor::class, 'deactivate' ) | |
| 167 | + ); | |
| 168 | +} | |
| 169 | + | |
| 122 | 170 | // Detect if secupress_scanner is running. |
| 123 | 171 | $mainwp_is_secupress_scanning = false; |
| 124 | 172 | if ( ! empty( $_GET ) && isset( $_GET['test'] ) && isset( $_GET['action'] ) && 'secupress_scanner' === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized.Recommended |
| 125 | 173 | $mainwp_is_secupress_scanning = true; |
| @@ -130,5 +178,9 @@ | ||
| 130 | 178 | $mainWP = new MainWP\Dashboard\MainWP_System( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __FILE__ ) ); |
| 131 | 179 | register_activation_hook( __FILE__, array( $mainWP, 'activation' ) ); |
| 132 | 180 | register_deactivation_hook( __FILE__, array( $mainWP, 'deactivation' ) ); |
| 133 | 181 | add_action( 'plugins_loaded', array( $mainWP, 'update_install' ) ); |
| 182 | + // Register the post-upgrade hook for MWP-1557/1558 pk/ filename migration. | |
| 183 | + // Must be registered before plugins_loaded fires so MainWP_Install::install() | |
| 184 | + // sees a subscriber when it does_action('mainwp_db_after_update'). | |
| 185 | + add_action( 'plugins_loaded', array( 'MainWP\\Dashboard\\MainWP_Keys_Manager', 'register_migration_hooks' ), 5 ); | |
| 134 | 186 | } |