From ec353829f305f4377a0fd4c5b30a455f9732eddf Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Thu, 5 Nov 2015 16:43:03 +0300 Subject: [PATCH] Update run.php --- run.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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);