@@ 107-124 (lines=18) @@ | ||
104 | { |
|
105 | } |
|
106 | ||
107 | public function writeAll(array $data) |
|
108 | { |
|
109 | $itemsAmount = count($data); |
|
110 | if( $itemsAmount == 0 ) |
|
111 | return; |
|
112 | ||
113 | $progress = new ConsoleProgressBar($itemsAmount); |
|
114 | $this->logger->log('Начало обработки файлов'); |
|
115 | $progress->start(); |
|
116 | foreach($data as $uniqueAttributeValue => $images) |
|
117 | { |
|
118 | $this->safeWriteItem($uniqueAttributeValue, $images); |
|
119 | $progress->setValueMap('memory', Yii::app()->format->formatSize(memory_get_usage())); |
|
120 | $progress->advance(); |
|
121 | } |
|
122 | $progress->finish(); |
|
123 | $this->logger->log('Обработка файлов завершена'); |
|
124 | } |
|
125 | ||
126 | public function writePartial(array $data) |
|
127 | { |
@@ 87-105 (lines=19) @@ | ||
84 | ImportHelper::clearUrlCache(null); |
|
85 | } |
|
86 | ||
87 | public function writeAll(array $data) |
|
88 | { |
|
89 | if( empty($data) ) |
|
90 | return; |
|
91 | ||
92 | $itemsAmount = count($data); |
|
93 | $this->allProductsAmount = $itemsAmount; |
|
94 | ||
95 | $progress = new ConsoleProgressBar($itemsAmount); |
|
96 | $this->logger->log('Начало записи в БД'); |
|
97 | $progress->start(); |
|
98 | foreach($data as $item) |
|
99 | { |
|
100 | $this->safeWriteItem($item); |
|
101 | $progress->setValueMap('memory', Yii::app()->format->formatSize(memory_get_usage())); |
|
102 | $progress->advance(); |
|
103 | } |
|
104 | $progress->finish(); |
|
105 | } |
|
106 | ||
107 | public function writePartial(array $data) |
|
108 | { |