Update run.php
This commit is contained in:
parent
dbbaea5215
commit
ec353829f3
9
run.php
9
run.php
@ -4,19 +4,26 @@ require(__DIR__ . "/config/config.php");
|
|||||||
|
|
||||||
if (! file_exists(__DIR__ . "/logs"))
|
if (! file_exists(__DIR__ . "/logs"))
|
||||||
mkdir(__DIR__ . "/logs");
|
mkdir(__DIR__ . "/logs");
|
||||||
|
|
||||||
if (file_exists(__DIR__ . "/logs/cookie.txt"))
|
if (file_exists(__DIR__ . "/logs/cookie.txt"))
|
||||||
unlink(__DIR__ . "/logs/cookie.txt");
|
unlink(__DIR__ . "/logs/cookie.txt");
|
||||||
|
|
||||||
$lockFile = __DIR__ . "/run.lock";
|
$lockFile = __DIR__ . "/run.lock";
|
||||||
|
|
||||||
if (file_exists($lockFile)) {
|
if (file_exists($lockFile)) {
|
||||||
if ((int)file_get_contents($lockFile) > time()) {
|
if ((int)file_get_contents($lockFile) > time()) {
|
||||||
echo "script is busy";
|
echo "script is busy";
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents("run.lock", strtotime('+5 minutes'));
|
file_put_contents("run.lock", strtotime('+5 minutes'));
|
||||||
|
|
||||||
|
if (file_exists(__DIR__ . "/logs/sync.log")) {
|
||||||
|
$config['date_from'] = file_get_contents(__DIR__ . "/logs/sync.log");
|
||||||
|
}
|
||||||
|
|
||||||
$apiHelper = new ApiHelper($сonfig);
|
$apiHelper = new ApiHelper($сonfig);
|
||||||
|
|
||||||
if ($apiHelper->processXMLOrders())
|
if ($apiHelper->processXMLOrders())
|
||||||
unlink($lockFile);
|
unlink($lockFile);
|
||||||
|
Loading…
Reference in New Issue
Block a user