Skip to content

Commit bf8b45c

Browse files
committed
refactored code to use existing function for clearing the configuraiton
1 parent d5bc784 commit bf8b45c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

app/code/Meta/BusinessExtension/Helper/FBEHelper.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,6 @@ public function deleteConfigKeys()
376376
$response = [];
377377
$response['success'] = false;
378378
try {
379-
$connection = $this->resourceConnection->getConnection();
380-
$facebook_config = $this->resourceConnection->getTableName('facebook_business_extension_config');
381-
$sql = "DELETE FROM $facebook_config WHERE config_key NOT LIKE 'permanent%' ";
382-
$connection->query($sql);
383-
384379
$this->systemConfig->deleteConfig(SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_EXTERNAL_BUSINESS_ID)
385380
->deleteConfig(SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_PIXEL_ID)
386381
->deleteConfig(SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_PIXEL_AAM_SETTINGS)

app/code/Meta/BusinessExtension/Setup/Patch/Data/UpdateConfigurations.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Meta\BusinessExtension\Model\System\Config as SystemConfig;
99
use Meta\BusinessExtension\Logger\Logger;
1010
use Magento\Store\Model\StoreManagerInterface;
11+
use Meta\BusinessExtension\Helper\FBEHelper;
1112

1213
class UpdateConfigurations implements DataPatchInterface
1314
{
@@ -34,6 +35,11 @@ class UpdateConfigurations implements DataPatchInterface
3435
*/
3536
private $moduleDataSetup;
3637

38+
/**
39+
* @var FBEHelper
40+
*/
41+
private $FBEHelper;
42+
3743
/**
3844
* Constructor
3945
*
@@ -46,12 +52,14 @@ public function __construct(
4652
ModuleDataSetupInterface $moduleDataSetup,
4753
SystemConfig $config,
4854
StoreManagerInterface $storeManager,
49-
Logger $logger
55+
Logger $logger,
56+
FBEHelper $FBEHelper
5057
) {
5158
$this->config = $config;
5259
$this->storeManager = $storeManager;
5360
$this->logger = $logger;
5461
$this->moduleDataSetup = $moduleDataSetup;
62+
$this->FBEHelper = $FBEHelper;
5563
}
5664

5765
/**
@@ -101,8 +109,8 @@ public function revert(): void
101109
$connection->startSetup();
102110

103111
$connection->dropTable(self::OLD_CONFIG_TABLE_NAME);
104-
$connection->delete('core_config_data', "path LIKE 'facebook/%'");
105112

113+
$this->FBEHelper->deleteConfigKeys();
106114
$connection->endSetup();
107115
}
108116

0 commit comments

Comments
 (0)