EnableDirectiveParsing.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Catalog\Setup\Patch\Data;
  8. use Magento\Framework\Setup\ModuleDataSetupInterface;
  9. use Magento\Framework\Setup\Patch\DataPatchInterface;
  10. /**
  11. * Class EnableDirectiveParsing
  12. * @package Magento\Catalog\Setup\Patch
  13. */
  14. class EnableDirectiveParsing implements DataPatchInterface
  15. {
  16. /**
  17. * @var ModuleDataSetupInterface
  18. */
  19. private $moduleDataSetup;
  20. /**
  21. * PatchInitial constructor.
  22. * @param ModuleDataSetupInterface $moduleDataSetup
  23. */
  24. public function __construct(
  25. ModuleDataSetupInterface $moduleDataSetup
  26. ) {
  27. $this->moduleDataSetup = $moduleDataSetup;
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function apply()
  33. {
  34. $configTable = $this->moduleDataSetup->getTable('core_config_data');
  35. $select = $this->moduleDataSetup->getConnection()->select()
  36. ->from($configTable)
  37. ->where('path = ?', 'catalog/frontend/parse_url_directives');
  38. $config = $this->moduleDataSetup->getConnection()->fetchAll($select);
  39. if (!empty($config)) {
  40. $this->moduleDataSetup->getConnection()->update(
  41. $configTable,
  42. ['value' => '1'],
  43. ['path = ?' => 'catalog/frontend/parse_url_directives', 'value IN (?)' => '0']
  44. );
  45. }
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public static function getDependencies()
  51. {
  52. return [];
  53. }
  54. /**
  55. * {@inheritdoc}
  56. */
  57. public function getAliases()
  58. {
  59. return [];
  60. }
  61. }