Skip to content

Commit 4cf59b4

Browse files
author
Dmytro Vilchynskyi
committed
Merge remote-tracking branch 'origin/MAGETWO-88184' into PR-13032018
2 parents d193074 + 921e175 commit 4cf59b4

File tree

1 file changed

+25
-3
lines changed
  • app/code/Magento/Catalog/Model/Indexer/Category/Product/Action

1 file changed

+25
-3
lines changed

app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,29 @@ public function __construct(
8787
$this->activeTableSwitcher = $activeTableSwitcher ?: $objectManager->get(ActiveTableSwitcher::class);
8888
}
8989

90+
/**
91+
*
92+
* Clear the table we'll be writing de-normalized data into
93+
* to prevent archived data getting in the way of actual data.
94+
*
95+
* @return void
96+
*/
97+
private function clearCurrentTable()
98+
{
99+
$this->connection->delete(
100+
$this->activeTableSwitcher
101+
->getAdditionalTableName($this->getMainTable())
102+
);
103+
}
104+
90105
/**
91106
* Refresh entities index
92107
*
93108
* @return $this
94109
*/
95110
public function execute()
96111
{
112+
$this->clearCurrentTable();
97113
$this->reindex();
98114
$this->activeTableSwitcher->switchTable($this->connection, [$this->getMainTable()]);
99115
return $this;
@@ -103,6 +119,9 @@ public function execute()
103119
* Return select for remove unnecessary data
104120
*
105121
* @return \Magento\Framework\DB\Select
122+
*
123+
* @deprecated Not used anymore.
124+
* @see clearCurrentTable()
106125
*/
107126
protected function getSelectUnnecessaryData()
108127
{
@@ -127,12 +146,14 @@ protected function getSelectUnnecessaryData()
127146
* Remove unnecessary data
128147
*
129148
* @return void
149+
*
150+
* @deprecated Not used anymore.
151+
* @see clearCurrentTable()
130152
*/
131153
protected function removeUnnecessaryData()
132154
{
133-
$this->connection->query(
134-
$this->connection->deleteFromSelect($this->getSelectUnnecessaryData(), $this->getMainTable())
135-
);
155+
//Called for backward compatibility.
156+
$this->getSelectUnnecessaryData();
136157
}
137158

138159
/**
@@ -233,6 +254,7 @@ private function reindexCategoriesBySelect(\Magento\Framework\DB\Select $basicSe
233254
)
234255
);
235256
$this->publishData();
257+
//Called for backward compatibility.
236258
$this->removeUnnecessaryData();
237259
}
238260
}

0 commit comments

Comments
 (0)