1
0
mirror of synced 2024-11-21 20:46:04 +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,19 +4,26 @@ require(__DIR__ . "/config/config.php");
if (! file_exists(__DIR__ . "/logs"))
mkdir(__DIR__ . "/logs");
if (file_exists(__DIR__ . "/logs/cookie.txt"))
unlink(__DIR__ . "/logs/cookie.txt");
$lockFile = __DIR__ . "/run.lock";
if (file_exists($lockFile)) {
if ((int)file_get_contents($lockFile) > time()) {
echo "script is busy";
exit();
}
}
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);
if ($apiHelper->processXMLOrders())
unlink($lockFile);
unlink($lockFile);