<?php
// prevent direct access
if (!defined('WD')) {
    exit;
}
global $REDIS_CONFIG;

function warn($message): void
{
    echo "\n\033[33m$message\033[0m\n";
}

// Check if the MINIO array is set
if (!isset($REDIS_CONFIG)) {
    throw new Exception('REDIS array is not set in config.php');
}
// Check if the MINIO array has the required keys
if (!isset($REDIS_CONFIG['host']) || !isset($REDIS_CONFIG['database']) || !isset($REDIS_CONFIG['password'])) {
    throw new Exception('REDIS array is missing required keys');
}
$timestart = microtime(true);
// Create a new Redis object
$logs_o = new objects\logs_o();
$logs_o->syncLogsToDatabase(true);
$timeend = microtime(true);
echo "\nLogs synced to database in " . ($timeend - $timestart) . 's';