| 1 |
<?php |
| 2 |
/** |
| 3 |
* System Monitor Bootstrap. |
| 4 |
* |
| 5 |
* Entry point for the System Monitor module. |
| 6 |
* |
| 7 |
* Responsibilities: |
| 8 |
* - Load autoloader / loader |
| 9 |
* - Initialize System Monitor core |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace MainWP\Dashboard\SystemMonitor; |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
require_once __DIR__ . '/class-mainwp-system-monitor-loader.php'; |
| 20 |
|
| 21 |
// Register the autoloader immediately so activation hooks and other early |
| 22 |
// entry points can load System Monitor classes. |
| 23 |
MainWP_System_Monitor_Loader::init(); |
| 24 |
|
| 25 |
|
| 26 |
/** |
| 27 |
* Bootstrap System Monitor module. |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
function bootstrap() { |
| 32 |
|
| 33 |
// Initialize the system monitor core. |
| 34 |
MainWP_System_Monitor::init(); |
| 35 |
|
| 36 |
add_filter( |
| 37 |
'cron_schedules', |
| 38 |
function ( $schedules ) { |
| 39 |
if ( ! isset( $schedules['minute'] ) ) { |
| 40 |
$schedules['minute'] = array( |
| 41 |
'interval' => MINUTE_IN_SECONDS, |
| 42 |
'display' => __( 'Every Minute', 'mainwp' ), |
| 43 |
); |
| 44 |
} |
| 45 |
return $schedules; |
| 46 |
} |
| 47 |
); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Hook bootstrap into WordPress. |
| 52 |
* |
| 53 |
* Using plugins_loaded ensures: |
| 54 |
* - WordPress is fully loaded |
| 55 |
* - other plugins are available |
| 56 |
* - safe place for module initialization |
| 57 |
*/ |
| 58 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\\bootstrap' ); |
| 59 |
|