File tree Expand file tree Collapse file tree 2 files changed +63
-11
lines changed
CatalogRuleSampleData/Setup
ConfigurableSampleData/Model Expand file tree Collapse file tree 2 files changed +63
-11
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+
7+ namespace Magento \CatalogRuleSampleData \Setup ;
8+
9+ use Magento \Framework \App \State ;
10+ use Magento \Framework \Indexer \IndexerInterfaceFactory ;
11+ use Magento \Framework \Setup \InstallDataInterface ;
12+ use Magento \Framework \Setup \ModuleContextInterface ;
13+ use Magento \Framework \Setup \ModuleDataSetupInterface ;
14+
15+ /**
16+ * Recurring data install.
17+ */
18+ class RecurringData implements InstallDataInterface
19+ {
20+ /**
21+ * @var State
22+ */
23+ private $ state ;
24+
25+ /**
26+ * @var \Magento\Indexer\Model\Indexer\CollectionFactory
27+ */
28+ private $ indexerCollectionFactory ;
29+
30+ /**
31+ * Init
32+ *
33+ * @param IndexerInterfaceFactory $indexerInterfaceFactory
34+ */
35+ public function __construct (
36+ State $ state ,
37+ \Magento \Indexer \Model \Indexer \CollectionFactory $ indexerCollectionFactory
38+ ) {
39+ $ this ->state = $ state ;
40+ $ this ->indexerCollectionFactory = $ indexerCollectionFactory ;
41+ }
42+
43+ /**
44+ * {@inheritdoc}
45+ */
46+ public function install (ModuleDataSetupInterface $ setup , ModuleContextInterface $ context )
47+ {
48+ $ this ->state ->emulateAreaCode (
49+ \Magento \Framework \App \Area::AREA_CRONTAB ,
50+ [$ this , 'reindex ' ]
51+ );
52+ }
53+
54+ /**
55+ * Perform full reindex
56+ */
57+ public function reindex ()
58+ {
59+ foreach ($ this ->indexerCollectionFactory ->create ()->getItems () as $ indexer ) {
60+ $ indexer ->reindexAll ();
61+ }
62+ }
63+ }
Original file line number Diff line number Diff line change @@ -98,16 +98,5 @@ public function install()
9898 chdir ($ currentPath );
9999
100100 $ this ->eavConfig ->clear ();
101- $ this ->reindex ();
102- }
103-
104- /**
105- * Perform full reindex
106- */
107- private function reindex ()
108- {
109- foreach ($ this ->indexerCollectionFactory ->create ()->getItems () as $ indexer ) {
110- $ indexer ->reindexAll ();
111- }
112101 }
113102}
You can’t perform that action at this time.
0 commit comments