Skip to content

Commit 11494b2

Browse files
Merge remote-tracking branch 'konarshankar07/23297_disable_force_reindex_issue' into 23297
2 parents 9941d17 + 409ccc6 commit 11494b2

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

app/code/Magento/Catalog/Model/Category.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,9 @@ public function reindex()
11591159
*/
11601160
public function afterDeleteCommit()
11611161
{
1162-
$this->reindex();
1162+
if ($this->getIsActive()) {
1163+
$this->reindex();
1164+
}
11631165
return parent::afterDeleteCommit();
11641166
}
11651167

app/code/Magento/Catalog/Model/ResourceModel/Category.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ protected function _beforeDelete(\Magento\Framework\DataObject $object)
232232
*/
233233
protected function _afterDelete(DataObject $object)
234234
{
235-
$this->indexerProcessor->markIndexerAsInvalid();
235+
if ($object->getIsActive()) {
236+
$this->indexerProcessor->markIndexerAsInvalid();
237+
}
236238
return parent::_afterDelete($object);
237239
}
238240

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Model/Plugin/Category.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Catalog\Model\ResourceModel\Category as Resource;
1111
use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor;
12+
use Magento\Framework\DataObject;
1213

1314
/**
1415
* Perform indexer invalidation after a category delete.
@@ -33,12 +34,15 @@ public function __construct(Processor $fulltextIndexerProcessor)
3334
*
3435
* @param Resource $subjectCategory
3536
* @param Resource $resultCategory
37+
* @param DataObject $object
3638
* @return Resource
3739
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3840
*/
39-
public function afterDelete(Resource $subjectCategory, Resource $resultCategory) : Resource
41+
public function afterDelete(Resource $subjectCategory, Resource $resultCategory, DataObject $object) : Resource
4042
{
41-
$this->fulltextIndexerProcessor->markIndexerAsInvalid();
43+
if ($object->getIsActive()) {
44+
$this->fulltextIndexerProcessor->markIndexerAsInvalid();
45+
}
4246

4347
return $resultCategory;
4448
}

0 commit comments

Comments
 (0)