diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 07ee9e7d0..e72afb64f 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -332,11 +332,18 @@ class G $ip = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); - } else { + } elseif (getenv('HTTP_X_FORWARDED')) { + $ip = getenv('HTTP_X_FORWARDED'); + } elseif (getenv('HTTP_FORWARDED_FOR')) { + $ip = getenv('HTTP_FORWARDED_FOR'); + } elseif (getenv('HTTP_FORWARDED')) { + $ip = getenv('HTTP_FORWARDED'); + } elseif (getenv('REMOTE_ADDR')) { $ip = getenv('REMOTE_ADDR'); - } - if ($ip === false) { + } elseif (class_exists('Request')) { $ip = Request::ip(); + } else { + $ip = gethostbyname(gethostname()); } return $ip; } diff --git a/workflow/engine/bin/cli.php b/workflow/engine/bin/cli.php index 62078a872..5407f9786 100644 --- a/workflow/engine/bin/cli.php +++ b/workflow/engine/bin/cli.php @@ -1,5 +1,7 @@ "1", "interval" => "week", "expression" => "*/10 * * * 0,1,2,3,4,5,6", - "description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC" + "description" => "ID_TASK_SCHEDULER_REPORT_USERS_DESC", + "initDate" => "+init-date", + "finishDate" => "+finish-date" ], [ "title" => "ID_TASK_SCHEDULER_REPORT_PROCESS", @@ -189,7 +191,9 @@ class TaskSchedulerBM "everyOn" => "1", "interval" => "week", "expression" => "*/10 * * * 0,1,2,3,4,5,6", - "description" => "ID_TASK_SCHEDULER_CALCULATE_APP_DESC" + "description" => "ID_TASK_SCHEDULER_CALCULATE_APP_DESC", + "initDate" => "+init-date", + "finishDate" => "+finish-date" ], [ "title" => "ID_TASK_SCHEDULER_LDAP", @@ -279,10 +283,25 @@ class TaskSchedulerBM $task->description = $service["description"]; $task->startingTime = $service["startingTime"]; $task->endingTime = $service["endingTime"]; + $activity = $service["service"]; + + //for init date and finish date parameters + $currentDate = date("Y-m-d H:i:s"); + $setOfActivities = ["report_by_user", "report_by_process"]; + if (!empty($service["initDate"]) && in_array($activity, $setOfActivities)) { + $oneMonthAgo = $currentDate . " -1 month"; + $timestamp = strtotime($oneMonthAgo); + $oneMonthAgo = date("Y-m-d H:i:s", $timestamp); + $activity = $activity . ' ' . $service["initDate"] . '"' . $oneMonthAgo . '"'; + } + if (!empty($service["finishDate"]) && in_array($activity, $setOfActivities)) { + $activity = $activity . ' ' . $service["initDate"] . '"' . $currentDate . '"'; + } + if ($win) { - $task->body = 'php "' . PATH_TRUNK . $service["filew"] . '" ' . $service["service"] . ' +w' . config("system.workspace") . ' +force +async'; + $task->body = 'php "' . PATH_TRUNK . $service["filew"] . '" ' . $activity . ' +w' . config("system.workspace") . ' +force +async'; } else { - $task->body = 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $service["service"] . ' +w' . config("system.workspace") . ' +force +async"'; + $task->body = 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $activity . ' +w' . config("system.workspace") . ' +force +async"'; } $task->expression = $service["expression"]; $task->type = "shell";