<?php
// pages/components/updates_check.php
// Async update check to avoid blocking the main page load.

// 1. Core Check
if (function_exists('mh_version_check_core')) {
    mh_version_check_core();
}

// 2. Pro Check
if (!class_exists('cloudbeez_status_handler')) {
    $handler_file = MH_DIR_FS_CATALOG . MH_ROOT_PATH . 'configbeez/config_cloudbeez/classes/cloudbeez_status_handler.php';
    if (file_exists($handler_file)) {
        include_once($handler_file);
    }
}

if (class_exists('cloudbeez_status_handler')) {
    // getStatus(true, false) will use cache if valid, or perform check if not.
    // Periodic background check.
    cloudbeez_status_handler::getStatus(true, false);
}

// Trigger a refresh of the updates UI if something changed.
header('HX-Trigger: updates-refresh');
exit;
