| @@ 67-84 (lines=18) @@ | ||
| 64 | $this->phpThumb->init(); |
|
| 65 | } |
|
| 66 | ||
| 67 | public function writeAll(array $data) |
|
| 68 | {
|
|
| 69 | $itemsAmount = count($data); |
|
| 70 | if( $itemsAmount == 0 ) |
|
| 71 | return; |
|
| 72 | ||
| 73 | $progress = new ConsoleProgressBar($itemsAmount); |
|
| 74 | $this->logger->log('Начало обработки файлов');
|
|
| 75 | $progress->start(); |
|
| 76 | foreach($data as $uniqueAttributeValue => $images) |
|
| 77 | {
|
|
| 78 | $this->safeWriteItem($uniqueAttributeValue, $images); |
|
| 79 | $progress->setValueMap('memory', Yii::app()->format->formatSize(memory_get_usage()));
|
|
| 80 | $progress->advance(); |
|
| 81 | } |
|
| 82 | $progress->finish(); |
|
| 83 | $this->logger->log('Обработка файлов завершена');
|
|
| 84 | } |
|
| 85 | ||
| 86 | public function writePartial(array $data) |
|
| 87 | {
|
|
| @@ 79-97 (lines=19) @@ | ||
| 76 | $this->skipProductsAmount = 0; |
|
| 77 | } |
|
| 78 | ||
| 79 | public function writeAll(array $data) |
|
| 80 | {
|
|
| 81 | if( empty($data) ) |
|
| 82 | return; |
|
| 83 | ||
| 84 | $itemsAmount = count($data); |
|
| 85 | $this->allProductsAmount = $itemsAmount; |
|
| 86 | ||
| 87 | $progress = new ConsoleProgressBar($itemsAmount); |
|
| 88 | $this->logger->log('Начало записи в БД');
|
|
| 89 | $progress->start(); |
|
| 90 | foreach($data as $item) |
|
| 91 | {
|
|
| 92 | $this->safeWriteItem($item); |
|
| 93 | $progress->setValueMap('memory', Yii::app()->format->formatSize(memory_get_usage()));
|
|
| 94 | $progress->advance(); |
|
| 95 | } |
|
| 96 | $progress->finish(); |
|
| 97 | } |
|
| 98 | ||
| 99 | public function writePartial(array $data) |
|
| 100 | {
|
|