Remove Cron Key Requirement from cron scripts in /scripts folder and set to only run on the cli

This commit is contained in:
johnnyq
2025-01-23 14:01:15 -05:00
parent c8e3e37d87
commit 70dd3ab5c8
6 changed files with 27 additions and 49 deletions

View File

@@ -10,6 +10,11 @@ $script_start_time = microtime(true); // unComment when Debugging Execution time
// Set working directory to the directory this cron script lives at.
chdir(dirname(__FILE__));
// Ensure we're running from command line
if (php_sapi_name() !== 'cli') {
die("This setup script must be run from the command line.\n");
}
// Get ITFlow config & helper functions
require_once "../config.php";
@@ -35,13 +40,6 @@ if ($config_ticket_email_parse == 0) {
exit("Email Parser: Feature is not enabled - check Settings > Ticketing > Email-to-ticket parsing. See https://docs.itflow.org/ticket_email_parse -- Quitting..");
}
$argv = $_SERVER['argv'];
// Check Cron Key
if ($argv[1] !== $config_cron_key) {
exit("Cron Key invalid -- Quitting..");
}
// Get system temp directory
$temp_dir = sys_get_temp_dir();