File tree Expand file tree Collapse file tree 3 files changed +60
-3
lines changed
dev/tools/performance-toolkit
framework/Magento/ToolkitFramework Expand file tree Collapse file tree 3 files changed +60
-3
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2015 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ /**
8
+ * Class IndexersApplyFixture
9
+ */
10
+ class IndexersApplyFixture extends \Magento \ToolkitFramework \Fixture
11
+ {
12
+ /**
13
+ * @var int
14
+ */
15
+ protected $ priority = 170 ;
16
+
17
+ /**
18
+ * {@inheritdoc}
19
+ */
20
+ public function execute ()
21
+ {
22
+ $ indexers = \Magento \ToolkitFramework \Config::getInstance ()->getValue ('indexers ' , array ());
23
+ $ this ->application ->resetObjectManager ();
24
+
25
+ foreach ($ indexers ["indexer " ] as $ indexer ) {
26
+ $ this ->application ->indexerStates [$ indexer ['id ' ]] = $ indexer ['set_scheduled ' ];
27
+ }
28
+
29
+ $ this ->application ->getObjectManager ()->get ('Magento\Framework\App\CacheInterface ' )
30
+ ->clean ([\Magento \Framework \App \Config::CACHE_TAG ]);
31
+ }
32
+
33
+ /**
34
+ * {@inheritdoc}
35
+ */
36
+ public function getActionTitle ()
37
+ {
38
+ return 'Indexer Mode Changes ' ;
39
+ }
40
+
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ public function introduceParamLabels ()
45
+ {
46
+ return [];
47
+ }
48
+ }
49
+
50
+ return new IndexersApplyFixture ($ this );
Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ class Application
69
69
*/
70
70
protected $ _initArguments ;
71
71
72
+ /**
73
+ * Indexer states values
74
+ *
75
+ * @var array
76
+ */
77
+ public $ indexerStates ;
78
+
72
79
/**
73
80
* @param string $applicationBaseDir
74
81
* @param \Magento\Framework\Shell $shell
Original file line number Diff line number Diff line change 46
46
$ indexerListIds = $ config ->getIndexers ();
47
47
/** @var $indexerRegistry \Magento\Indexer\Model\IndexerRegistry */
48
48
$ indexerRegistry = $ application ->getObjectManager ()->create ('Magento\Indexer\Model\IndexerRegistry ' );
49
- $ indexersState = [];
49
+ $ application -> indexerStates = [];
50
50
foreach ($ indexerListIds as $ key => $ indexerId ) {
51
51
$ indexer = $ indexerRegistry ->get ($ indexerId ['indexer_id ' ]);
52
- $ indexersState [$ indexerId ['indexer_id ' ]] = $ indexer ->isScheduled ();
52
+ $ application -> indexerStates [$ indexerId ['indexer_id ' ]] = $ indexer ->isScheduled ();
53
53
$ indexer ->setScheduled (true );
54
54
}
55
55
65
65
foreach ($ indexerListIds as $ indexerId ) {
66
66
/** @var $indexer \Magento\Indexer\Model\Indexer */
67
67
$ indexer = $ indexerRegistry ->get ($ indexerId ['indexer_id ' ]);
68
- $ indexer ->setScheduled ($ indexersState [$ indexerId ['indexer_id ' ]]);
68
+ $ indexer ->setScheduled ($ application -> indexerStates [$ indexerId ['indexer_id ' ]]);
69
69
}
70
70
71
71
$ application ->reindex ();
You can’t perform that action at this time.
0 commit comments