boot(); } return self::$instance; } /** * Boot modules. */ private function boot() { // Translations load just in time from translate.wordpress.org language packs. Aeoora_Install::maybe_upgrade(); // Public-facing modules. Each one checks its own settings switch. Aeoora_Blocker::init(); Aeoora_Tracker::init(); Aeoora_Referrals::init(); Aeoora_Robots::init(); Aeoora_Llms::init(); Aeoora_Markdown::init(); Aeoora_Schema::init(); Aeoora_Meta::init(); Aeoora_Indexnow::init(); Aeoora_Audit::init(); Aeoora_Suggestions::init(); Aeoora_Reports::init(); Aeoora_Compat::init(); Aeoora_Blocks::init(); Aeoora_Abilities::init(); Aeoora_Cloud::init(); // Optional; inert until the site owner connects. add_action( 'rest_api_init', array( 'Aeoora_Rest', 'register_routes' ) ); add_action( 'aeoora_daily', array( __CLASS__, 'daily' ) ); add_action( 'aeoora_prune', array( __CLASS__, 'prune' ) ); add_action( 'aeoora_send_report', array( 'Aeoora_Reports', 'cron' ) ); add_action( Aeoora_Queue::HOOK, array( 'Aeoora_Queue', 'run' ) ); add_action( 'aeoora_warm_render', array( 'Aeoora_Content', 'warm_render' ) ); // Events queued by 1.0.0. add_action( 'init', array( 'Aeoora_Install', 'ensure_cron' ) ); add_action( 'init', array( 'Aeoora_Install', 'migrate_settings' ), 5 ); if ( is_multisite() ) { add_action( 'wp_initialize_site', array( 'Aeoora_Install', 'initialize_site' ), 100 ); add_filter( 'wpmu_drop_tables', array( 'Aeoora_Install', 'drop_site_tables' ), 10, 2 ); } if ( is_admin() ) { Aeoora_Admin::init(); Aeoora_Editor::init(); } if ( defined( 'WP_CLI' ) && WP_CLI ) { Aeoora_Cli::register(); } add_action( 'admin_init', array( 'Aeoora_Privacy', 'add_policy_content' ) ); } /** * Daily job: hands each task to its own cron event, so a task that fails * or runs out of time never stops the others (the report goes first). */ public static function daily() { $now = time(); $tasks = array( 'aeoora_send_report' => $now, 'aeoora_prune' => $now + MINUTE_IN_SECONDS, 'aeoora_regenerate_llms' => $now + 5 * MINUTE_IN_SECONDS, 'aeoora_suggestions_run' => $now + 10 * MINUTE_IN_SECONDS, 'aeoora_scan_site' => $now + 15 * MINUTE_IN_SECONDS, ); foreach ( $tasks as $hook => $at ) { if ( ! wp_next_scheduled( $hook ) ) { wp_schedule_single_event( $at, $hook ); } } } /** * Maintenance: log retention, expired cache files, aeoora Cloud queue. * Time-boxed; schedules itself again while there is more to delete. */ public static function prune() { $done = Aeoora_Tracker::prune(); Aeoora_Cache::cleanup(); Aeoora_Cloud::maintenance(); Aeoora_Suggestions::prune(); if ( ! $done && ! wp_next_scheduled( 'aeoora_prune' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'aeoora_prune' ); } } }