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