Files
votianng/html/export/cron_export_HHA.php
2026-03-29 10:34:57 +02:00

68 lines
2.5 KiB
PHP

<?php
/*=======================================================================
*
* cron_export_HHA.php
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
// include_once ("../include/ftp.inc.php");
if ($argv[1] == "acapella7890") :
// Error reporting
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$path = getAbsoluteSystemPath();
$passwd = "acapella7890";
$logFile = $path . "/log/cron_auto_export.log";
$emptyArgument = "\"\"";
$fileNamePrefix = substr(getDateTime("6"), 0, 12); // Format: "YmdHi"
$requestMode = trim($argv[2]);
if ($requestMode == "" || !is_numeric($requestMode)) : $requestMode = "103"; endif; // Init "Alarm"
// date_firstday_lastmonth_currentyear
$date_from = date("Ymd",mktime(0,0,0,date("m")-1,1,date("Y"))); // 20200101, ....
$date_to = date("Ymd",mktime(0,0,0,date("m"),0,date("Y"))); // 20200131, ....
$f_act = "execute";
$hqId = "1";
$f_sort = "0";
$f_stat_export = "1"; // csv-Export
$f_ftp_upload = $emptyArgument;
$sendMode = "NONE";
$exportPars = array();
$exportPars["HHA_EXPORT"] = array($f_act,$hqId,$requestMode,$date_from,$date_to,$f_sort,$f_stat_export,$f_ftp_upload,$sendMode);
$exportParsKeys = array_keys($exportPars);
$exportParsKeysLen = count($exportParsKeys);
if ($exportParsKeysLen != "" && is_numeric($exportParsKeysLen)) :
// Exports
for ($i = 0; $i < $exportParsKeysLen; $i++) :
list($f_act,$hq_id,$requestMode,$date_from,$date_to,$f_sort,$f_stat_export,$f_ftp_upload,$sendMode) = $exportPars[$exportParsKeys[$i]];
// $cmd = "php " . $path . "/export/export_illt.php " . $passwd . " " . $f_act . " " . $hq_id . " " . $requestMode . " " . $date_from . " " . $date_to . " " . $f_sort . " " . $f_stat_export . " " . $f_ftp_upload . " " . $sendMode . " " . " &";
$cmd = "php " . $path . "/export/export_illt_MC.php " . $passwd . " " . $f_act . " " . $hq_id . " " . $requestMode . " " . $date_from . " " . $date_to . " " . $f_sort . " " . $f_stat_export . " " . $f_ftp_upload . " " . $sendMode . " " . " &";
// echo $exportParsKeys[$i] . ":\n";
// echo $cmd . "\n\n\n";
// echo $cmd . "\n\n\n"; die();
$cmdOutput = null;
exec($cmd, $cmdOutput);
// list($errNo, $errDesc) = $cmdOutput;
$currentTime = getDateTime("0");
writeToFile($logFile, "OP=AUTO_EXPORT|DATETIME=" . $currentTime . "|CUST=" . $exportParsKeys[$i]);
sleep(5); // Avoid too many tasks
endfor;
endif;
endif;
?>