mirror of https://github.com/itflow-org/itflow
Remove Cron Key Requirement from cron scripts in /scripts folder and set to only run on the cli
This commit is contained in:
parent
c8e3e37d87
commit
70dd3ab5c8
|
|
@ -9,10 +9,10 @@ require_once "config.php";
|
||||||
$checks = [];
|
$checks = [];
|
||||||
|
|
||||||
// Execute the git command to get the latest commit hash
|
// Execute the git command to get the latest commit hash
|
||||||
$commitHash = exec('git log -1 --format=%H');
|
$commitHash = shell_exec('git log -1 --format=%H');
|
||||||
|
|
||||||
// Get branch info
|
// Get branch info
|
||||||
$gitBranch = exec('git rev-parse --abbrev-ref HEAD');
|
$gitBranch = shell_exec('git rev-parse --abbrev-ref HEAD');
|
||||||
|
|
||||||
// Section: System Information
|
// Section: System Information
|
||||||
$systemInfo = [];
|
$systemInfo = [];
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,17 @@
|
||||||
// Set working directory to the directory this cron script lives at.
|
// Set working directory to the directory this cron script lives at.
|
||||||
chdir(dirname(__FILE__));
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
require_once "../config.php";
|
require_once "../config.php";
|
||||||
|
|
||||||
// Set Timezone
|
// Set Timezone
|
||||||
require_once "../inc_set_timezone.php";
|
require_once "../inc_set_timezone.php";
|
||||||
|
|
||||||
require_once "../functions.php";
|
require_once "../functions.php";
|
||||||
|
|
||||||
|
|
||||||
$sql_companies = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
|
$sql_companies = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_companies);
|
$row = mysqli_fetch_array($sql_companies);
|
||||||
|
|
@ -28,7 +31,6 @@ $company_currency = sanitizeInput($row['company_currency']);
|
||||||
|
|
||||||
// Company Settings
|
// Company Settings
|
||||||
$config_enable_cron = intval($row['config_enable_cron']);
|
$config_enable_cron = intval($row['config_enable_cron']);
|
||||||
$config_cron_key = $row['config_cron_key'];
|
|
||||||
$config_invoice_overdue_reminders = $row['config_invoice_overdue_reminders'];
|
$config_invoice_overdue_reminders = $row['config_invoice_overdue_reminders'];
|
||||||
$config_invoice_prefix = sanitizeInput($row['config_invoice_prefix']);
|
$config_invoice_prefix = sanitizeInput($row['config_invoice_prefix']);
|
||||||
$config_invoice_from_email = sanitizeInput($row['config_invoice_from_email']);
|
$config_invoice_from_email = sanitizeInput($row['config_invoice_from_email']);
|
||||||
|
|
@ -88,18 +90,11 @@ $config_stripe_expense_category = intval($row['config_stripe_expense_category'])
|
||||||
$config_stripe_percentage_fee = floatval($row['config_stripe_percentage_fee']);
|
$config_stripe_percentage_fee = floatval($row['config_stripe_percentage_fee']);
|
||||||
$config_stripe_flat_fee = floatval($row['config_stripe_flat_fee']);
|
$config_stripe_flat_fee = floatval($row['config_stripe_flat_fee']);
|
||||||
|
|
||||||
$argv = $_SERVER['argv'];
|
|
||||||
|
|
||||||
// Check cron is enabled
|
// Check cron is enabled
|
||||||
if ($config_enable_cron == 0) {
|
if ($config_enable_cron == 0) {
|
||||||
exit("Cron: is not enabled -- Quitting..");
|
exit("Cron: is not enabled -- Quitting..");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Cron Key
|
|
||||||
if ( $argv[1] !== $config_cron_key ) {
|
|
||||||
exit("Cron Key invalid -- Quitting..");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ###############################################################################################################
|
* ###############################################################################################################
|
||||||
* STARTUP ACTIONS
|
* STARTUP ACTIONS
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,15 @@
|
||||||
// Set working directory to the directory this cron script lives at.
|
// Set working directory to the directory this cron script lives at.
|
||||||
chdir(dirname(__FILE__));
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
require_once "../config.php";
|
require_once "../config.php";
|
||||||
|
|
||||||
// Set Timezone
|
// Set Timezone
|
||||||
require_once "../inc_set_timezone.php";
|
require_once "../inc_set_timezone.php";
|
||||||
|
|
||||||
require_once "../functions.php";
|
require_once "../functions.php";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,20 +21,12 @@ $row = mysqli_fetch_array($sql_settings);
|
||||||
|
|
||||||
// Company Settings
|
// Company Settings
|
||||||
$config_enable_cron = intval($row['config_enable_cron']);
|
$config_enable_cron = intval($row['config_enable_cron']);
|
||||||
$config_cron_key = $row['config_cron_key'];
|
|
||||||
|
|
||||||
$argv = $_SERVER['argv'];
|
|
||||||
|
|
||||||
// Check cron is enabled
|
// Check cron is enabled
|
||||||
if ($config_enable_cron == 0) {
|
if ($config_enable_cron == 0) {
|
||||||
exit("Cron: is not enabled -- Quitting..");
|
exit("Cron: is not enabled -- Quitting..");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Cron Key
|
|
||||||
if ( $argv[1] !== $config_cron_key ) {
|
|
||||||
exit("Cron Key invalid -- Quitting..");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ###############################################################################################################
|
* ###############################################################################################################
|
||||||
* UPDATE CERTIFICATE EXPIRY DATE
|
* UPDATE CERTIFICATE EXPIRY DATE
|
||||||
|
|
|
||||||
|
|
@ -3,34 +3,29 @@
|
||||||
// Set working directory to the directory this cron script lives at.
|
// Set working directory to the directory this cron script lives at.
|
||||||
chdir(dirname(__FILE__));
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
require_once "../config.php";
|
require_once "../config.php";
|
||||||
|
|
||||||
// Set Timezone
|
// Set Timezone
|
||||||
require_once "../inc_set_timezone.php";
|
require_once "../inc_set_timezone.php";
|
||||||
|
|
||||||
require_once "../functions.php";
|
require_once "../functions.php";
|
||||||
|
|
||||||
|
|
||||||
$sql_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE settings.company_id = 1");
|
$sql_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE settings.company_id = 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_settings);
|
$row = mysqli_fetch_array($sql_settings);
|
||||||
|
|
||||||
// Company Settings
|
// Company Settings
|
||||||
$config_enable_cron = intval($row['config_enable_cron']);
|
$config_enable_cron = intval($row['config_enable_cron']);
|
||||||
$config_cron_key = $row['config_cron_key'];
|
|
||||||
|
|
||||||
$argv = $_SERVER['argv'];
|
|
||||||
|
|
||||||
// Check cron is enabled
|
// Check cron is enabled
|
||||||
if ($config_enable_cron == 0) {
|
if ($config_enable_cron == 0) {
|
||||||
exit("Cron: is not enabled -- Quitting..");
|
exit("Cron: is not enabled -- Quitting..");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Cron Key
|
|
||||||
if ( $argv[1] !== $config_cron_key ) {
|
|
||||||
exit("Cron Key invalid -- Quitting..");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ###############################################################################################################
|
* ###############################################################################################################
|
||||||
* REFRESH DATA
|
* REFRESH DATA
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,14 @@
|
||||||
// Set working directory to the directory this cron script lives at.
|
// Set working directory to the directory this cron script lives at.
|
||||||
chdir(dirname(__FILE__));
|
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
|
// Set Timezone
|
||||||
require_once "../inc_set_timezone.php";
|
require_once "../inc_set_timezone.php";
|
||||||
|
|
||||||
require_once "../functions.php";
|
require_once "../functions.php";
|
||||||
|
|
||||||
$sql_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
|
$sql_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
|
||||||
|
|
@ -16,27 +19,18 @@ $row = mysqli_fetch_array($sql_settings);
|
||||||
|
|
||||||
// Company Settings
|
// Company Settings
|
||||||
$config_enable_cron = intval($row['config_enable_cron']);
|
$config_enable_cron = intval($row['config_enable_cron']);
|
||||||
$config_cron_key = $row['config_cron_key'];
|
|
||||||
$config_smtp_host = $row['config_smtp_host'];
|
$config_smtp_host = $row['config_smtp_host'];
|
||||||
$config_smtp_username = $row['config_smtp_username'];
|
$config_smtp_username = $row['config_smtp_username'];
|
||||||
$config_smtp_password = $row['config_smtp_password'];
|
$config_smtp_password = $row['config_smtp_password'];
|
||||||
$config_smtp_port = intval($row['config_smtp_port']);
|
$config_smtp_port = intval($row['config_smtp_port']);
|
||||||
$config_smtp_encryption = $row['config_smtp_encryption'];
|
$config_smtp_encryption = $row['config_smtp_encryption'];
|
||||||
|
|
||||||
$argv = $_SERVER['argv'];
|
|
||||||
|
|
||||||
// Check cron is enabled
|
// Check cron is enabled
|
||||||
if ($config_enable_cron == 0) {
|
if ($config_enable_cron == 0) {
|
||||||
error_log("Mail queue error - Cron is not enabled");
|
error_log("Mail queue error - Cron is not enabled");
|
||||||
exit("Cron: is not enabled -- Quitting..");
|
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
|
// Get system temp directory
|
||||||
$temp_dir = sys_get_temp_dir();
|
$temp_dir = sys_get_temp_dir();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.
|
// Set working directory to the directory this cron script lives at.
|
||||||
chdir(dirname(__FILE__));
|
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
|
// Get ITFlow config & helper functions
|
||||||
require_once "../config.php";
|
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..");
|
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
|
// Get system temp directory
|
||||||
$temp_dir = sys_get_temp_dir();
|
$temp_dir = sys_get_temp_dir();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue