Skip to content

Commit dbea58a

Browse files
MC-32014: Remove google-shopping-ads module from core in 2.4.1
1 parent d909923 commit dbea58a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/internal/Magento/Framework/Mview/TriggerCleaner.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,24 @@ public function __construct(
5454
*/
5555
public function removeTriggers(): bool
5656
{
57+
// Get list of views that are enabled
5758
$viewCollection = $this->viewCollectionFactory->create();
5859
$viewList = $viewCollection->getViewsByStateMode(StateInterface::MODE_ENABLED);
5960

60-
// Unsubscribe mviews
61+
// Unsubscribe existing view to remove triggers from db
6162
foreach ($viewList as $view) {
6263
$view->unsubscribe();
6364
}
6465

65-
// Unsubscribe old views that still have triggers in db
66+
// Remove any remaining triggers from db that are not linked to a view
6667
$triggerTableNames = $this->getTableNamesWithTriggers();
6768
foreach ($triggerTableNames as $tableName) {
6869
$view = $this->createViewByTableName($tableName);
6970
$view->unsubscribe();
7071
$view->getState()->delete();
7172
}
7273

73-
// Re-subscribe mviews
74+
// Restore the previous state of the views to add triggers back to db
7475
foreach ($viewList as $view) {
7576
$view->subscribe();
7677
}
@@ -100,6 +101,9 @@ private function getTableNamesWithTriggers(): array
100101
/**
101102
* Create view by db table name
102103
*
104+
* Create a view that has the table name so that unsubscribe can be used to
105+
* remove triggers with the correct naming structure from the db
106+
*
103107
* @param string $tableName
104108
* @return ViewInterface
105109
*/

0 commit comments

Comments
 (0)