'baseline_created', 'severity' => 1, 'summary' => 'Initial system baseline created.', 'context' => array( 'fingerprint' => $fingerprint ), ) ); if ( ! wp_next_scheduled( 'edrad_daily_maintenance' ) ) { wp_schedule_event( time() + HOUR_IN_SECONDS, 'daily', 'edrad_daily_maintenance' ); } } /** * Repair missing per-site tables. The light-weight checks are limited to * administrators, at most once per day after a successful verification. */ public static function ensure_site_schema() { if ( ! current_user_can( 'manage_options' ) ) { return; } $last_check = (int) get_option( 'edrad_schema_checked_at', 0 ); if ( $last_check > time() - DAY_IN_SECONDS ) { return; } if ( ! EDRAD_Database::schema_exists() ) { EDRAD_Database::install(); } if ( EDRAD_Database::schema_exists() ) { update_option( 'edrad_version', EDRAD_VERSION, false ); update_option( 'edrad_schema_checked_at', time(), false ); } } /** Provision a newly created site without touching network-level plugins. */ public static function initialize_new_site( $site ) { if ( ! is_multisite() || ! $site instanceof WP_Site ) { return; } switch_to_blog( (int) $site->blog_id ); try { EDRAD_Database::install(); if ( EDRAD_Database::schema_exists() ) { update_option( 'edrad_version', EDRAD_VERSION, false ); update_option( 'edrad_schema_checked_at', time(), false ); } } finally { restore_current_blog(); } } /** No filesystem-based recovery is exposed on Multisite. */ public static function multisite_notice() { if ( ! current_user_can( 'manage_options' ) || ! function_exists( 'get_current_screen' ) ) { return; } $screen = get_current_screen(); if ( ! $screen || false === strpos( (string) $screen->id, 'error-division-radar' ) ) { return; } echo '
' . esc_html__( 'Multisite mode: Radar monitors this site independently. Rescue and plugin-isolation actions are disabled on Multisite.', 'error-division-radar' ) . '