Skip to content

Commit e3981ff

Browse files
authored
Merge pull request #2108 from magento-trigger/MAGETWO-87551
[trigger] MAGETWO-86717: Data Patches conversion
2 parents 47267e6 + fd2c145 commit e3981ff

File tree

405 files changed

+14304
-7720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

405 files changed

+14304
-7720
lines changed

app/code/Magento/AdminNotification/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_AdminNotification" setup_version="2.0.0">
9+
<module name="Magento_AdminNotification" >
1010
<sequence>
1111
<module name="Magento_Store"/>
1212
</sequence>

app/code/Magento/AdvancedPricingImportExport/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_AdvancedPricingImportExport" setup_version="2.0.0">
9+
<module name="Magento_AdvancedPricingImportExport" >
1010
</module>
1111
</config>

app/code/Magento/Analytics/Setup/InstallData.php

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

app/code/Magento/Analytics/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Analytics" setup_version="2.0.0">
9+
<module name="Magento_Analytics" >
1010
<sequence>
1111
<module name="Magento_Integration"/>
1212
<module name="Magento_Backend"/>

app/code/Magento/Authorization/Setup/InstallData.php renamed to app/code/Magento/Authorization/Setup/Patch/Data/InitializeAuthRoles.php

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,48 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
namespace Magento\Authorization\Setup;
7+
namespace Magento\Authorization\Setup\Patch\Data;
88

9-
use Magento\Framework\Setup\InstallDataInterface;
10-
use Magento\Framework\Setup\ModuleContextInterface;
9+
use Magento\Framework\App\ResourceConnection;
1110
use Magento\Framework\Setup\ModuleDataSetupInterface;
11+
use Magento\Setup\Model\Patch\DataPatchInterface;
12+
use Magento\Setup\Model\Patch\PatchVersionInterface;
1213
use Magento\Authorization\Model\Acl\Role\Group as RoleGroup;
1314
use Magento\Authorization\Model\UserContextInterface;
1415

1516
/**
16-
* @codeCoverageIgnore
17+
* Class InitializeAuthRoles
18+
* @package Magento\Authorization\Setup\Patch
1719
*/
18-
class InstallData implements InstallDataInterface
20+
class InitializeAuthRoles implements DataPatchInterface, PatchVersionInterface
1921
{
2022
/**
21-
* Authorization factory
22-
*
23-
* @var AuthorizationFactory
23+
* @var ModuleDataSetupInterface
24+
*/
25+
private $moduleDataSetup;
26+
27+
/**
28+
* @var \Magento\Authorization\Setup\AuthorizationFactory
2429
*/
2530
private $authFactory;
2631

2732
/**
28-
* Init
29-
*
30-
* @param AuthorizationFactory $authFactory
33+
* InitializeAuthRoles constructor.
34+
* @param ModuleDataSetupInterface $moduleDataSetup
35+
* @param \Magento\Authorization\Setup\AuthorizationFactory $authorizationFactory
3136
*/
32-
public function __construct(AuthorizationFactory $authFactory)
33-
{
34-
$this->authFactory = $authFactory;
37+
public function __construct(
38+
ModuleDataSetupInterface $moduleDataSetup,
39+
\Magento\Authorization\Setup\AuthorizationFactory $authorizationFactory
40+
) {
41+
$this->moduleDataSetup = $moduleDataSetup;
42+
$this->authFactory = $authorizationFactory;
3543
}
3644

3745
/**
3846
* {@inheritdoc}
3947
*/
40-
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
48+
public function apply()
4149
{
4250
$roleCollection = $this->authFactory->createRoleCollection()
4351
->addFieldToFilter('parent_id', 0)
@@ -60,6 +68,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
6068
]
6169
)->save();
6270
} else {
71+
/** @var \Magento\Authorization\Model\ResourceModel\Role $item */
6372
foreach ($roleCollection as $item) {
6473
$admGroupRole = $item;
6574
break;
@@ -89,13 +98,36 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
8998
/**
9099
* Delete rows by condition from authorization_rule
91100
*/
92-
$setup->startSetup();
93-
94-
$tableName = $setup->getTable('authorization_rule');
101+
$tableName = $this->moduleDataSetup->getTable('authorization_rule');
95102
if ($tableName) {
96-
$setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']);
103+
$this->moduleDataSetup->getConnection()->delete(
104+
$tableName,
105+
['resource_id = ?' => 'admin/system/tools/compiler']
106+
);
97107
}
108+
}
109+
110+
/**
111+
* {@inheritdoc}
112+
*/
113+
public static function getDependencies()
114+
{
115+
return [];
116+
}
98117

99-
$setup->endSetup();
118+
/**
119+
* {@inheritdoc}
120+
*/
121+
public static function getVersion()
122+
{
123+
return '2.0.0';
124+
}
125+
126+
/**
127+
* {@inheritdoc}
128+
*/
129+
public function getAliases()
130+
{
131+
return [];
100132
}
101133
}

app/code/Magento/Authorization/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Authorization" setup_version="2.0.0">
9+
<module name="Magento_Authorization" >
1010
<sequence>
1111
<module name="Magento_Backend"/>
1212
</sequence>

app/code/Magento/Authorizenet/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Authorizenet" setup_version="2.0.0">
9+
<module name="Magento_Authorizenet" >
1010
<sequence>
1111
<module name="Magento_Sales"/>
1212
<module name="Magento_Quote"/>

app/code/Magento/Backend/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Backend" setup_version="2.0.0">
9+
<module name="Magento_Backend" >
1010
<sequence>
1111
<module name="Magento_Directory"/>
1212
</sequence>

app/code/Magento/Backup/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Backup" setup_version="2.0.0">
9+
<module name="Magento_Backup" >
1010
<sequence>
1111
<module name="Magento_Store"/>
1212
</sequence>

0 commit comments

Comments
 (0)