mirror of
https://github.com/retailcrm/legacy.git
synced 2025-02-19 16:23:15 +03:00
fix catalog export bug
This commit is contained in:
parent
e836c6ae64
commit
2f9596be2b
@ -23,6 +23,7 @@ class IcmlHelper
|
||||
protected $offers;
|
||||
|
||||
protected $chunk = 500;
|
||||
protected $fileLifeTime = 3600;
|
||||
|
||||
public function __construct($shop, $file)
|
||||
{
|
||||
@ -33,10 +34,16 @@ class IcmlHelper
|
||||
|
||||
public function generate($categories, $offers)
|
||||
{
|
||||
if (!file_exists($this->tmpFile)) {
|
||||
if (file_exists($this->tmpFile)) {
|
||||
if (filectime($this->tmpFile) + $this->fileLifeTime < time()) {
|
||||
unlink($this->tmpFile);
|
||||
$this->writeHead();
|
||||
}
|
||||
} else {
|
||||
$this->writeHead();
|
||||
}
|
||||
|
||||
try {
|
||||
if (!empty($categories)) {
|
||||
$this->writeCategories($categories);
|
||||
unset($categories);
|
||||
@ -55,6 +62,9 @@ class IcmlHelper
|
||||
|
||||
file_put_contents($this->tmpFile, $formatted);
|
||||
rename($this->tmpFile, $this->file);
|
||||
} catch (Exception $e) {
|
||||
unlink($this->tmpFile);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadXml()
|
||||
|
Loading…
x
Reference in New Issue
Block a user