<?php
if (!class_exists('Database')) require_once("common_cadline_libraries/crm_database.class.php");

$status = 'Success';
$msg = '';

Database::getInstance()->query("SELECT * FROM cl_hlusers.cron_check");
$cronFunctions = Database::getInstance()->fetchAssoc();

foreach ($cronFunctions as $function) {
    $timeStamp = time() - $function['modified'];

    if ($timeStamp > 180)
        $status = 'Failed';

    $msg .= 'Function: ' . $function['function'] . '<br>';
    $msg .= 'Last run: ' . date('Y-m-d H:i:s', $function['modified']) . '<br><br>';
}

echo 'Cron status: ' . $status . '<br><br>';
echo $msg;
