mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 10:54:52 +00:00
Remove Cron Key Requirement from cron scripts in /scripts folder and set to only run on the cli
This commit is contained in:
@@ -3,11 +3,14 @@
|
||||
// Set working directory to the directory this cron script lives at.
|
||||
chdir(dirname(__FILE__));
|
||||
|
||||
require_once "../config.php";
|
||||
// Ensure we're running from command line
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
die("This setup script must be run from the command line.\n");
|
||||
}
|
||||
|
||||
require_once "../config.php";
|
||||
// Set Timezone
|
||||
require_once "../inc_set_timezone.php";
|
||||
|
||||
require_once "../functions.php";
|
||||
|
||||
$sql_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
|
||||
@@ -16,27 +19,18 @@ $row = mysqli_fetch_array($sql_settings);
|
||||
|
||||
// Company Settings
|
||||
$config_enable_cron = intval($row['config_enable_cron']);
|
||||
$config_cron_key = $row['config_cron_key'];
|
||||
$config_smtp_host = $row['config_smtp_host'];
|
||||
$config_smtp_username = $row['config_smtp_username'];
|
||||
$config_smtp_password = $row['config_smtp_password'];
|
||||
$config_smtp_port = intval($row['config_smtp_port']);
|
||||
$config_smtp_encryption = $row['config_smtp_encryption'];
|
||||
|
||||
$argv = $_SERVER['argv'];
|
||||
|
||||
// Check cron is enabled
|
||||
if ($config_enable_cron == 0) {
|
||||
error_log("Mail queue error - Cron is not enabled");
|
||||
exit("Cron: is not enabled -- Quitting..");
|
||||
}
|
||||
|
||||
// Check Cron Key
|
||||
if ($argv[1] !== $config_cron_key) {
|
||||
error_log("Mail queue error - Invalid cron key supplied");
|
||||
exit("Cron Key invalid -- Quitting..");
|
||||
}
|
||||
|
||||
// Get system temp directory
|
||||
$temp_dir = sys_get_temp_dir();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user