PrepareInitialConfig.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Analytics\Setup\Patch\Data;
  7. use Magento\Analytics\Model\Config\Backend\Enabled\SubscriptionHandler;
  8. use Magento\Framework\Setup\ModuleDataSetupInterface;
  9. use Magento\Framework\Setup\Patch\DataPatchInterface;
  10. use Magento\Framework\Setup\Patch\PatchVersionInterface;
  11. /**
  12. * Initial patch.
  13. *
  14. * @package Magento\Analytics\Setup\Patch
  15. */
  16. class PrepareInitialConfig implements DataPatchInterface, PatchVersionInterface
  17. {
  18. /**
  19. * @var ModuleDataSetupInterface
  20. */
  21. private $moduleDataSetup;
  22. /**
  23. * PrepareInitialConfig constructor.
  24. * @param ModuleDataSetupInterface $moduleDataSetup
  25. */
  26. public function __construct(
  27. ModuleDataSetupInterface $moduleDataSetup
  28. ) {
  29. $this->moduleDataSetup = $moduleDataSetup;
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function apply()
  35. {
  36. $this->moduleDataSetup->getConnection()->insertMultiple(
  37. $this->moduleDataSetup->getTable('core_config_data'),
  38. [
  39. [
  40. 'scope' => 'default',
  41. 'scope_id' => 0,
  42. 'path' => 'analytics/subscription/enabled',
  43. 'value' => 1
  44. ],
  45. [
  46. 'scope' => 'default',
  47. 'scope_id' => 0,
  48. 'path' => SubscriptionHandler::CRON_STRING_PATH,
  49. 'value' => join(' ', SubscriptionHandler::CRON_EXPR_ARRAY)
  50. ]
  51. ]
  52. );
  53. $this->moduleDataSetup->getConnection()->insert(
  54. $this->moduleDataSetup->getTable('flag'),
  55. [
  56. 'flag_code' => SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE,
  57. 'state' => 0,
  58. 'flag_data' => 24,
  59. ]
  60. );
  61. }
  62. /**
  63. * {@inheritdoc}
  64. */
  65. public static function getDependencies()
  66. {
  67. return [];
  68. }
  69. /**
  70. * {@inheritdoc}
  71. */
  72. public static function getVersion()
  73. {
  74. return '2.0.0';
  75. }
  76. /**
  77. * {@inheritdoc}
  78. */
  79. public function getAliases()
  80. {
  81. return [];
  82. }
  83. }