Skip to content

Commit f7407a4

Browse files
authored
Merge pull request #7 from saphaljha/2.2-develop-PR-port-19416
[Backport] 19404 fixed newsletter issue
2 parents e0d8308 + e99069c commit f7407a4

File tree

429 files changed

+34239
-15761
lines changed

Some content is hidden

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

429 files changed

+34239
-15761
lines changed

CHANGELOG.md

Lines changed: 147 additions & 0 deletions
Large diffs are not rendered by default.

app/code/Magento/AdminNotification/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lib-libxml": "*"
1212
},
1313
"type": "magento2-module",
14-
"version": "100.2.4",
14+
"version": "100.2.5",
1515
"license": [
1616
"OSL-3.0",
1717
"AFL-3.0"

app/code/Magento/AdvancedPricingImportExport/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"magento/framework": "101.0.*"
1414
},
1515
"type": "magento2-module",
16-
"version": "100.2.4",
16+
"version": "100.2.5",
1717
"license": [
1818
"OSL-3.0",
1919
"AFL-3.0"

app/code/Magento/Analytics/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"magento/framework": "101.0.*"
1111
},
1212
"type": "magento2-module",
13-
"version": "100.2.3",
13+
"version": "100.2.4",
1414
"license": [
1515
"OSL-3.0",
1616
"AFL-3.0"

app/code/Magento/Authorization/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"magento/framework": "101.0.*"
88
},
99
"type": "magento2-module",
10-
"version": "100.2.2",
10+
"version": "100.2.3",
1111
"license": [
1212
"OSL-3.0",
1313
"AFL-3.0"

app/code/Magento/Authorizenet/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"magento/module-config": "101.0.*"
1717
},
1818
"type": "magento2-module",
19-
"version": "100.2.2",
19+
"version": "100.2.3",
2020
"license": [
2121
"proprietary"
2222
],

app/code/Magento/Backend/Block/System/Store/Delete/Form.php

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,39 @@
55
*/
66
namespace Magento\Backend\Block\System\Store\Delete;
77

8+
use Magento\Backup\Helper\Data as BackupHelper;
9+
use Magento\Framework\App\ObjectManager;
10+
811
/**
912
* Adminhtml cms block edit form
1013
*
1114
* @author Magento Core Team <[email protected]>
1215
*/
1316
class Form extends \Magento\Backend\Block\Widget\Form\Generic
1417
{
18+
/**
19+
* @var BackupHelper
20+
*/
21+
private $backup;
22+
23+
/**
24+
* @param \Magento\Backend\Block\Template\Context $context
25+
* @param \Magento\Framework\Registry $registry
26+
* @param \Magento\Framework\Data\FormFactory $formFactory
27+
* @param array $data
28+
* @param BackupHelper|null $backup
29+
*/
30+
public function __construct(
31+
\Magento\Backend\Block\Template\Context $context,
32+
\Magento\Framework\Registry $registry,
33+
\Magento\Framework\Data\FormFactory $formFactory,
34+
array $data = [],
35+
BackupHelper $backup = null
36+
) {
37+
parent::__construct($context, $registry, $formFactory, $data);
38+
$this->backup = $backup ?? ObjectManager::getInstance()->get(BackupHelper::class);
39+
}
40+
1541
/**
1642
* Init form
1743
*
@@ -25,7 +51,7 @@ protected function _construct()
2551
}
2652

2753
/**
28-
* {@inheritdoc}
54+
* @inheritDoc
2955
*/
3056
protected function _prepareForm()
3157
{
@@ -45,15 +71,21 @@ protected function _prepareForm()
4571

4672
$fieldset->addField('item_id', 'hidden', ['name' => 'item_id', 'value' => $dataObject->getId()]);
4773

74+
$backupOptions = ['0' => __('No')];
75+
$backupSelected = '0';
76+
if ($this->backup->isEnabled()) {
77+
$backupOptions['1'] = __('Yes');
78+
$backupSelected = '1';
79+
}
4880
$fieldset->addField(
4981
'create_backup',
5082
'select',
5183
[
5284
'label' => __('Create DB Backup'),
5385
'title' => __('Create DB Backup'),
5486
'name' => 'create_backup',
55-
'options' => ['1' => __('Yes'), '0' => __('No')],
56-
'value' => '1'
87+
'options' => $backupOptions,
88+
'value' => $backupSelected
5789
]
5890
);
5991

app/code/Magento/Backend/Controller/Adminhtml/System/Store.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Store controller
1515
*
1616
* @author Magento Core Team <[email protected]>
17+
* @SuppressWarnings(PHPMD.AllPurposeAction)
1718
*/
1819
abstract class Store extends Action
1920
{
@@ -86,6 +87,8 @@ protected function createPage()
8687
* Backup database
8788
*
8889
* @return bool
90+
*
91+
* @deprecated Backup module is to be removed.
8992
*/
9093
protected function _backupDatabase()
9194
{

app/code/Magento/Backend/Model/AdminPathConfig.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,38 @@ public function __construct(
4848
}
4949

5050
/**
51-
* {@inheritdoc}
52-
*
53-
* @param \Magento\Framework\App\RequestInterface $request
54-
* @return string
51+
* @inheritdoc
5552
*/
5653
public function getCurrentSecureUrl(\Magento\Framework\App\RequestInterface $request)
5754
{
5855
return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
5956
}
6057

6158
/**
62-
* {@inheritdoc}
63-
*
64-
* @param string $path
65-
* @return bool
59+
* @inheritdoc
6660
*/
6761
public function shouldBeSecure($path)
6862
{
69-
return parse_url(
70-
(string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'),
71-
PHP_URL_SCHEME
72-
) === 'https'
73-
|| $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)
74-
&& parse_url(
75-
(string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'),
76-
PHP_URL_SCHEME
77-
) === 'https';
63+
$baseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default');
64+
if (parse_url($baseUrl, PHP_URL_SCHEME) === 'https') {
65+
return true;
66+
}
67+
68+
if ($this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)) {
69+
if ($this->backendConfig->isSetFlag('admin/url/use_custom')) {
70+
$adminBaseUrl = (string)$this->coreConfig->getValue('admin/url/custom', 'default');
71+
} else {
72+
$adminBaseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default');
73+
}
74+
75+
return parse_url($adminBaseUrl, PHP_URL_SCHEME) === 'https';
76+
}
77+
78+
return false;
7879
}
7980

8081
/**
81-
* {@inheritdoc}
82-
*
83-
* @return string
82+
* @inheritdoc
8483
*/
8584
public function getDefaultPath()
8685
{
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!--Login as any user-->
12+
<actionGroup name="AdminLoginAsAnyUser">
13+
<arguments>
14+
<argument name="login" type="string" defaultValue="{{_ENV.MAGENTO_ADMIN_USERNAME}}"/>
15+
<argument name="password" type="string" defaultValue="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/>
16+
</arguments>
17+
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
18+
<fillField userInput="{{login}}" selector="{{AdminLoginFormSection.username}}" stepKey="fillUsername"/>
19+
<fillField userInput="{{password}}" selector="{{AdminLoginFormSection.password}}" stepKey="fillPassword"/>
20+
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
21+
<closeAdminNotification stepKey="closeAdminNotification"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<element name="test" type="input" selector=".test"/>
1212
<element name="success" type="text" selector="#messages div.message-success"/>
1313
<element name="successMessageByIndex" type="text" selector=".message.message-success.success:nth-of-type({{n}})>div" parameterized="true"/>
14+
<element name="error" type="text" selector="#messages div.message-error"/>
1415
</section>
1516
</sections>

app/code/Magento/Backend/Test/Unit/Model/AdminPathConfigTest.php

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,35 @@ public function testGetCurrentSecureUrl()
7676
* @param $unsecureBaseUrl
7777
* @param $useSecureInAdmin
7878
* @param $secureBaseUrl
79+
* @param $useCustomUrl
80+
* @param $customUrl
7981
* @param $expected
8082
* @dataProvider shouldBeSecureDataProvider
8183
*/
82-
public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureBaseUrl, $expected)
83-
{
84-
$coreConfigValueMap = [
84+
public function testShouldBeSecure(
85+
$unsecureBaseUrl,
86+
$useSecureInAdmin,
87+
$secureBaseUrl,
88+
$useCustomUrl,
89+
$customUrl,
90+
$expected
91+
) {
92+
$coreConfigValueMap = $this->returnValueMap([
8593
[\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default', null, $unsecureBaseUrl],
8694
[\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'default', null, $secureBaseUrl],
87-
];
88-
$this->coreConfig->expects($this->any())->method('getValue')->will($this->returnValueMap($coreConfigValueMap));
89-
$this->backendConfig->expects($this->any())->method('isSetFlag')->willReturn($useSecureInAdmin);
95+
['admin/url/custom', 'default', null, $customUrl],
96+
]);
97+
$backendConfigFlagsMap = $this->returnValueMap([
98+
[\Magento\Store\Model\Store::XML_PATH_SECURE_IN_ADMINHTML, $useSecureInAdmin],
99+
['admin/url/use_custom', $useCustomUrl],
100+
]);
101+
$this->coreConfig->expects($this->atLeast(1))->method('getValue')
102+
->will($coreConfigValueMap);
103+
$this->coreConfig->expects($this->atMost(2))->method('getValue')
104+
->will($coreConfigValueMap);
105+
106+
$this->backendConfig->expects($this->atMost(2))->method('isSetFlag')
107+
->will($backendConfigFlagsMap);
90108
$this->assertEquals($expected, $this->adminPathConfig->shouldBeSecure(''));
91109
}
92110

@@ -96,13 +114,13 @@ public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureB
96114
public function shouldBeSecureDataProvider()
97115
{
98116
return [
99-
['http://localhost/', false, 'default', false],
100-
['http://localhost/', true, 'default', false],
101-
['https://localhost/', false, 'default', true],
102-
['https://localhost/', true, 'default', true],
103-
['http://localhost/', false, 'https://localhost/', false],
104-
['http://localhost/', true, 'https://localhost/', true],
105-
['https://localhost/', true, 'https://localhost/', true],
117+
['http://localhost/', false, 'default', false, '', false],
118+
['http://localhost/', true, 'default', false, '', false],
119+
['https://localhost/', false, 'default', false, '', true],
120+
['https://localhost/', true, 'default', false, '', true],
121+
['http://localhost/', false, 'https://localhost/', false, '', false],
122+
['http://localhost/', true, 'https://localhost/', false, '', true],
123+
['https://localhost/', true, 'https://localhost/', false, '', true],
106124
];
107125
}
108126

app/code/Magento/Backend/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"magento/module-theme": "100.2.*"
2525
},
2626
"type": "magento2-module",
27-
"version": "100.2.6",
27+
"version": "100.2.7",
2828
"license": [
2929
"OSL-3.0",
3030
"AFL-3.0"

app/code/Magento/Backup/Controller/Adminhtml/Index.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
*/
66
namespace Magento\Backup\Controller\Adminhtml;
77

8+
use Magento\Backup\Helper\Data as Helper;
9+
use Magento\Framework\App\ObjectManager;
10+
811
/**
912
* Backup admin controller
1013
*
1114
* @author Magento Core Team <[email protected]>
1215
* @api
1316
* @since 100.0.2
17+
* @SuppressWarnings(PHPMD.AllPurposeAction)
1418
*/
1519
abstract class Index extends \Magento\Backend\App\Action
1620
{
@@ -48,27 +52,47 @@ abstract class Index extends \Magento\Backend\App\Action
4852
*/
4953
protected $maintenanceMode;
5054

55+
/**
56+
* @var Helper
57+
*/
58+
private $helper;
59+
5160
/**
5261
* @param \Magento\Backend\App\Action\Context $context
5362
* @param \Magento\Framework\Registry $coreRegistry
5463
* @param \Magento\Framework\Backup\Factory $backupFactory
5564
* @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
5665
* @param \Magento\Backup\Model\BackupFactory $backupModelFactory
5766
* @param \Magento\Framework\App\MaintenanceMode $maintenanceMode
67+
* @param Helper|null $helper
5868
*/
5969
public function __construct(
6070
\Magento\Backend\App\Action\Context $context,
6171
\Magento\Framework\Registry $coreRegistry,
6272
\Magento\Framework\Backup\Factory $backupFactory,
6373
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
6474
\Magento\Backup\Model\BackupFactory $backupModelFactory,
65-
\Magento\Framework\App\MaintenanceMode $maintenanceMode
75+
\Magento\Framework\App\MaintenanceMode $maintenanceMode,
76+
Helper $helper = null
6677
) {
6778
$this->_coreRegistry = $coreRegistry;
6879
$this->_backupFactory = $backupFactory;
6980
$this->_fileFactory = $fileFactory;
7081
$this->_backupModelFactory = $backupModelFactory;
7182
$this->maintenanceMode = $maintenanceMode;
83+
$this->helper = $helper ?? ObjectManager::getInstance()->get(Helper::class);
7284
parent::__construct($context);
7385
}
86+
87+
/**
88+
* @inheritDoc
89+
*/
90+
public function dispatch(\Magento\Framework\App\RequestInterface $request)
91+
{
92+
if (!$this->helper->isEnabled()) {
93+
return $this->_redirect('*/*/disabled');
94+
}
95+
96+
return parent::dispatch($request);
97+
}
7498
}

0 commit comments

Comments
 (0)