|
1 |
| -<?php |
2 |
| -/** |
3 |
| - * Copyright © 2015 Magento. All rights reserved. |
4 |
| - * See COPYING.txt for license details. |
5 |
| - */ |
6 |
| - |
7 |
| -namespace Magento\Catalog\Plugin\Model\Indexer\Category\Product; |
8 |
| - |
9 |
| -use Magento\Catalog\Model\Indexer\Category\Product\Action\Full; |
10 |
| -use Magento\Catalog\Model\ResourceModel\MaxHeapTableSizeProcessor; |
11 |
| -use Psr\Log\LoggerInterface; |
12 |
| - |
13 |
| -class MaxHeapTableSizeProcessorOnFullReindex |
14 |
| -{ |
15 |
| - /** |
16 |
| - * @var MaxHeapTableSizeProcessor |
17 |
| - */ |
18 |
| - protected $maxHeapTableSizeProcessor; |
19 |
| - |
20 |
| - /** |
21 |
| - * @param MaxHeapTableSizeProcessor $maxHeapTableSizeProcessor |
22 |
| - * @param LoggerInterface $logger |
23 |
| - */ |
24 |
| - public function __construct( |
25 |
| - MaxHeapTableSizeProcessor $maxHeapTableSizeProcessor, |
26 |
| - LoggerInterface $logger |
27 |
| - ) { |
28 |
| - $this->maxHeapTableSizeProcessor = $maxHeapTableSizeProcessor; |
29 |
| - $this->logger = $logger; |
30 |
| - } |
31 |
| - |
32 |
| - /** |
33 |
| - * @param Full $subject |
34 |
| - * @return void |
35 |
| - * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
36 |
| - */ |
37 |
| - public function beforeExecute(Full $subject) |
38 |
| - { |
39 |
| - try { |
40 |
| - $this->maxHeapTableSizeProcessor->set(); |
41 |
| - } catch (\Exception $e) { |
42 |
| - $this->logger->error($e); |
43 |
| - } |
44 |
| - } |
45 |
| - |
46 |
| - /** |
47 |
| - * @param Full $subject |
48 |
| - * @param Full $result |
49 |
| - * @return Full |
50 |
| - * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
51 |
| - */ |
52 |
| - public function afterExecute(Full $subject, Full $result) |
53 |
| - { |
54 |
| - try { |
55 |
| - $this->maxHeapTableSizeProcessor->restore(); |
56 |
| - } catch (\Exception $e) { |
57 |
| - $this->logger->error($e); |
58 |
| - } |
59 |
| - return $result; |
60 |
| - } |
61 |
| -} |
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © 2015 Magento. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | + |
| 7 | +namespace Magento\Catalog\Plugin\Model\Indexer\Category\Product; |
| 8 | + |
| 9 | +use Magento\Catalog\Model\Indexer\Category\Product\Action\Full; |
| 10 | +use Magento\Catalog\Model\ResourceModel\MaxHeapTableSizeProcessor; |
| 11 | +use Psr\Log\LoggerInterface; |
| 12 | + |
| 13 | +class MaxHeapTableSizeProcessorOnFullReindex |
| 14 | +{ |
| 15 | + /** |
| 16 | + * @var MaxHeapTableSizeProcessor |
| 17 | + */ |
| 18 | + protected $maxHeapTableSizeProcessor; |
| 19 | + |
| 20 | + /** |
| 21 | + * @param MaxHeapTableSizeProcessor $maxHeapTableSizeProcessor |
| 22 | + * @param LoggerInterface $logger |
| 23 | + */ |
| 24 | + public function __construct( |
| 25 | + MaxHeapTableSizeProcessor $maxHeapTableSizeProcessor, |
| 26 | + LoggerInterface $logger |
| 27 | + ) { |
| 28 | + $this->maxHeapTableSizeProcessor = $maxHeapTableSizeProcessor; |
| 29 | + $this->logger = $logger; |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * @param Full $subject |
| 34 | + * @return void |
| 35 | + * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
| 36 | + */ |
| 37 | + public function beforeExecute(Full $subject) |
| 38 | + { |
| 39 | + try { |
| 40 | + $this->maxHeapTableSizeProcessor->set(); |
| 41 | + } catch (\Exception $e) { |
| 42 | + $this->logger->error($e); |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * @param Full $subject |
| 48 | + * @param Full $result |
| 49 | + * @return Full |
| 50 | + * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
| 51 | + */ |
| 52 | + public function afterExecute(Full $subject, Full $result) |
| 53 | + { |
| 54 | + try { |
| 55 | + $this->maxHeapTableSizeProcessor->restore(); |
| 56 | + } catch (\Exception $e) { |
| 57 | + $this->logger->error($e); |
| 58 | + } |
| 59 | + return $result; |
| 60 | + } |
| 61 | +} |
0 commit comments