Commit 2a47d6e723189e8898b764e7b54b29c15560cfd4
1 parent
fc593532
Ntr
Showing
1 changed file
with
13 additions
and
10 deletions
Show diff stats
common/modules/product/models/Import.php
@@ -60,17 +60,19 @@ class Import extends Model { | @@ -60,17 +60,19 @@ class Import extends Model { | ||
60 | public function goPrices($from = 0, $limit = null) { | 60 | public function goPrices($from = 0, $limit = null) { |
61 | set_time_limit(0); | 61 | set_time_limit(0); |
62 | $new_products = $linked_products = 0; | 62 | $new_products = $linked_products = 0; |
63 | - if (file_exists(Yii::getAlias('@uploadDir/goPrices.lock'))) { | ||
64 | - return 'Task already executed'; | ||
65 | - } | ||
66 | - $ff = fopen(Yii::getAlias('@uploadDir/goPrices.lock'), 'w+'); | ||
67 | - fclose($ff); | 63 | + |
68 | 64 | ||
69 | if ( !($handle = $this->getProductsFile('uploadFilePrices')) ) { | 65 | if ( !($handle = $this->getProductsFile('uploadFilePrices')) ) { |
70 | $this->errors[] = 'File not found'; | 66 | $this->errors[] = 'File not found'; |
71 | return FALSE; | 67 | return FALSE; |
72 | } | 68 | } |
73 | 69 | ||
70 | + if (file_exists(Yii::getAlias('@uploadDir/goPrices.lock'))) { | ||
71 | + return 'Task already executed'; | ||
72 | + } | ||
73 | + $ff = fopen(Yii::getAlias('@uploadDir/goPrices.lock'), 'w+'); | ||
74 | + fclose($ff); | ||
75 | + | ||
74 | $filesize = filesize(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices')); | 76 | $filesize = filesize(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices')); |
75 | if ($from) { | 77 | if ($from) { |
76 | fseek($handle, $from); | 78 | fseek($handle, $from); |
@@ -221,16 +223,17 @@ class Import extends Model { | @@ -221,16 +223,17 @@ class Import extends Model { | ||
221 | 223 | ||
222 | set_time_limit(0); | 224 | set_time_limit(0); |
223 | $new_products = $linked_products = 0; | 225 | $new_products = $linked_products = 0; |
224 | - if (file_exists(Yii::getAlias('@uploadDir/goProducts.lock'))) { | ||
225 | - return 'Task already executed'; | ||
226 | - } | ||
227 | - $ff = fopen(Yii::getAlias('@uploadDir/goProducts.lock'), 'w+'); | ||
228 | - fclose($ff); | 226 | + |
229 | 227 | ||
230 | if ( !($handle = $this->getProductsFile('uploadFileProducts')) ) { | 228 | if ( !($handle = $this->getProductsFile('uploadFileProducts')) ) { |
231 | $this->errors[] = 'File not found'; | 229 | $this->errors[] = 'File not found'; |
232 | return FALSE; | 230 | return FALSE; |
233 | } | 231 | } |
232 | + if (file_exists(Yii::getAlias('@uploadDir/goProducts.lock'))) { | ||
233 | + return 'Task already executed'; | ||
234 | + } | ||
235 | + $ff = fopen(Yii::getAlias('@uploadDir/goProducts.lock'), 'w+'); | ||
236 | + fclose($ff); | ||
234 | 237 | ||
235 | $filesize = filesize(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFileProducts')); | 238 | $filesize = filesize(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFileProducts')); |
236 | 239 |