added Traffic.listing ApiCommand; added first Unit-Tests for Traffic-Api; SQL IN-clause cannot be prepared, replaced all occurances accordingly; added --no-fork parameter to traffic-cron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -29,7 +29,8 @@ if (count($argv) < 2 || (isset($argv[1]) && strtolower($argv[1]) == '--help')) {
|
||||
echo "Below are possible parameters for this file\n\n";
|
||||
echo "--[cronname]\t\tincludes the given cron-file\n";
|
||||
echo "--force\t\t\tforces re-generating of config-files (webserver, nameserver, etc.)\n";
|
||||
echo "--debug\t\t\toutput debug information about what is going on to STDOUT.\n\n";
|
||||
echo "--debug\t\t\toutput debug information about what is going on to STDOUT.\n";
|
||||
echo "--no-fork\t\t\tdo not fork to backkground (traffic cron only).\n\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,6 +57,9 @@ for ($x = 1; $x < count($argv); $x++) {
|
||||
elseif (strtolower($argv[$x]) == '--debug') {
|
||||
define('CRON_DEBUG_FLAG', 1);
|
||||
}
|
||||
elseif (strtolower($argv[$x]) == '--no-fork') {
|
||||
define('CRON_NOFORK_FLAG', 1);
|
||||
}
|
||||
// --[cronname]
|
||||
elseif (substr(strtolower($argv[$x]), 0, 2) == '--') {
|
||||
if (strlen($argv[$x]) > 3) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
// Check Traffic-Lock
|
||||
if (function_exists('pcntl_fork')) {
|
||||
if (function_exists('pcntl_fork') && !defined('CRON_NOFORK_FLAG')) {
|
||||
$TrafficLock = makeCorrectFile(dirname($lockfile)."/froxlor_cron_traffic.lock");
|
||||
if (file_exists($TrafficLock)
|
||||
&& is_numeric($TrafficPid=file_get_contents($TrafficLock))
|
||||
@@ -606,7 +606,7 @@ while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = 'system' AND `varname` = 'last_traffic_run'");
|
||||
|
||||
if (function_exists('pcntl_fork')) {
|
||||
if (function_exists('pcntl_fork') && !defined('CRON_NOFORK_FLAG')) {
|
||||
@unlink($TrafficLock);
|
||||
die();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user