$error, 'output' => $output], JSON_PRETTY_PRINT); die(); } $cache->setCache('queue'); $last_run = intval($cache->retrieve('last_run') ?? 0); $interval = floatval(Settings::get('queue_interval') ?? 1); $runner = Settings::get('queue_runner'); if ($runner == 'cron') { if (!isset($_GET['cron'])) { return_json('Invalid cron URL', true); } if (Input::get('key') != Settings::get('cron_key')) { return_json('Invalid cron key', true); } } $date = date('U'); $next_run = $last_run + ($interval * 60); $diff = $next_run - $date; if ($last_run && $diff > 0) { return_json("Please wait $diff seconds before executing the queue", true); } // Update last run immediately $cache->store('last_run', $date); // Load modules + template Module::loadPage($user, $pages, $cache, $smarty, [$navigation, $cc_nav, $staffcp_nav], $widgets, $template); $template->onPageLoad(); // Process queue $tasks = Queue::process($container); return_json($tasks);