diff --git a/run.php b/run.php index 0271f53..7c29848 100644 --- a/run.php +++ b/run.php @@ -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); \ No newline at end of file + unlink($lockFile);