Skip to content

Commit ba05253

Browse files
committed
MAGETWO-89238: [Sales email] Disabled invoice emails produce performance issue
1 parent 3d0cd00 commit ba05253

31 files changed

+21
-124
lines changed

app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public function execute()
3737
try {
3838
$model->delete();
3939

40-
//$this->_eventManager->dispatch('store_delete', ['store' => $model]);
41-
4240
$this->messageManager->addSuccess(__('You deleted the store view.'));
4341
return $redirectResult->setPath('adminhtml/*/');
4442
} catch (\Magento\Framework\Exception\LocalizedException $e) {

app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ private function processWebsiteSave($postData)
4646
*/
4747
private function processStoreSave($postData)
4848
{
49-
//$eventName = 'store_edit';
5049
/** @var \Magento\Store\Model\Store $storeModel */
5150
$storeModel = $this->_objectManager->create(\Magento\Store\Model\Store::class);
5251
$postData['store']['name'] = $this->filterManager->removeTags($postData['store']['name']);
@@ -56,7 +55,6 @@ private function processStoreSave($postData)
5655
$storeModel->setData($postData['store']);
5756
if ($postData['store']['store_id'] == '') {
5857
$storeModel->setId(null);
59-
//$eventName = 'store_add';
6058
}
6159
$groupModel = $this->_objectManager->create(
6260
\Magento\Store\Model\Group::class
@@ -70,8 +68,6 @@ private function processStoreSave($postData)
7068
);
7169
}
7270
$storeModel->save();
73-
//$this->_objectManager->get(\Magento\Store\Model\StoreManager::class)->reinitStores();
74-
//$this->_eventManager->dispatch($eventName, ['store' => $storeModel]);
7571
$this->messageManager->addSuccess(__('You saved the store view.'));
7672

7773
return $postData;
@@ -102,7 +98,6 @@ private function processGroupSave($postData)
10298
);
10399
}
104100
$groupModel->save();
105-
//$this->_eventManager->dispatch('store_group_save', ['group' => $groupModel]);
106101
$this->messageManager->addSuccess(__('You saved the store.'));
107102

108103
return $postData;

app/code/Magento/Store/Model/Config/Importer/Processor/Create.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ private function createStores(array $items, array $data)
218218
$store->getResource()->addCommitCallback(function () use ($store, $group, $website) {
219219
$store->setGroup($group);
220220
$store->setWebsite($website);
221-
$store->getResource()->save($store);
222-
223-
//$this->eventManager->dispatch('store_add', ['store' => $store]);
221+
$store->save();
224222
});
225223
}
226224
}

app/code/Magento/Store/Model/Config/Importer/Processor/Delete.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ private function deleteStores(array $items)
169169
foreach ($items as $storeCode) {
170170
$store = $this->storeRepository->get($storeCode);
171171
$store->delete();
172-
// $store->getResource()->delete($store);
173-
// $store->getResource()->addCommitCallback(function () use ($store) {
174-
// $this->eventManager->dispatch('store_delete', ['store' => $store]);
175-
// });
176172
}
177173
}
178174

app/code/Magento/Store/Model/Config/Importer/Processor/Update.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ private function updateStores(array $items, array $data)
177177
}
178178

179179
$store->save();
180-
// $store->getResource()->save($store);
181-
// $store->getResource()->addCommitCallback(function () use ($store) {
182-
// $this->eventManager->dispatch('store_edit', ['store' => $store]);
183-
// });
184180
}
185181
}
186182

@@ -216,10 +212,6 @@ private function updateGroups(array $items, array $data)
216212
$group->setWebsite($website);
217213
}
218214
$group->save();
219-
// $group->getResource()->save($group);
220-
// $group->getResource()->addCommitCallback(function () use ($group) {
221-
// $this->eventManager->dispatch('store_group_save', ['group' => $group]);
222-
// });
223215
}
224216
}
225217

app/code/Magento/Store/Test/Unit/Model/Config/Importer/Processor/UpdateTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testRun()
175175
$updateData[ScopeInterface::SCOPE_STORES],
176176
],
177177
]);
178-
$this->websiteMock->expects($this->exactly(4))
178+
$this->websiteMock->expects($this->atLeastOnce())
179179
->method('getResource')
180180
->willReturn($this->websiteResourceMock);
181181
$this->websiteMock->expects($this->once())
@@ -203,7 +203,7 @@ public function testRun()
203203
$this->groupFactoryMock->expects($this->exactly(3))
204204
->method('create')
205205
->willReturn($this->groupMock);
206-
$this->groupMock->expects($this->exactly(5))
206+
$this->groupMock->expects($this->atLeastOnce())
207207
->method('getResource')
208208
->willReturn($this->groupResourceMock);
209209
$this->groupMock->expects($this->once())
@@ -227,7 +227,7 @@ public function testRun()
227227
$this->storeFactoryMock->expects($this->exactly(2))
228228
->method('create')
229229
->willReturn($this->storeMock);
230-
$this->storeMock->expects($this->exactly(4))
230+
$this->storeMock->expects($this->atLeastOnce())
231231
->method('getResource')
232232
->willReturn($this->storeResourceMock);
233233
$this->storeMock->expects($this->once())
@@ -244,9 +244,9 @@ public function testRun()
244244
$this->storeMock->expects($this->once())
245245
->method('setData')
246246
->with($updateData[ScopeInterface::SCOPE_STORES]['test']);
247-
$this->storeResourceMock->expects($this->once())
247+
$this->storeMock->expects($this->once())
248248
->method('save')
249-
->with($this->storeMock);
249+
->willReturnSelf();
250250

251251
$this->model->run($data);
252252
}

dev/tests/integration/testsuite/Magento/Catalog/Console/Command/ProductAttributesCleanUpTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,6 @@ private function prepareAdditionalStore()
107107
->setGroupId($storeGroup->getId())
108108
->save();
109109

110-
/* Refresh stores memory cache */
111-
//$this->objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
112-
// /* Dispatch "store_group_save" event */
113-
// $this->objectManager->get(
114-
// \Magento\Framework\Event\ManagerInterface::class
115-
// )->dispatch('store_group_save', ['group' => $storeGroup]);
116-
117110
return $store;
118111
}
119112
}

dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@
4242
$store->save();
4343
}
4444

45-
/* Refresh stores memory cache */
46-
//\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
47-
// \Magento\Store\Model\StoreManagerInterface::class
48-
//)->reinitStores();
49-
/* Dispatch "store_add" event */
50-
//\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
51-
// \Magento\Framework\Event\ManagerInterface::class
52-
//)->dispatch('store_add', ['store' => $store]);
53-
5445
/** @var \Magento\Catalog\Model\Category $newCategory */
5546
$newCategory = $factory->create();
5647
$newCategory

dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_two_websites.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
$website->save();
2121

22-
//$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
22+
$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
2323

2424
/** @var $product \Magento\Catalog\Model\Product */
2525
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()

dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_two_websites_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
$registry->unregister('isSecureArea');
3333
$registry->register('isSecureArea', false);
3434

35-
//$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
35+
$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();

0 commit comments

Comments
 (0)