1
0
mirror of synced 2024-11-22 04:56:05 +03:00

Update run.php

This commit is contained in:
Alex Lushpai 2015-11-05 16:43:03 +03:00
parent dbbaea5215
commit ec353829f3

View File

@ -4,18 +4,25 @@ 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())