Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit edd3a2f

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into 2.2-develop-pr60
2 parents 2430b3d + 8c6000f commit edd3a2f

File tree

292 files changed

+31225
-15269
lines changed

Some content is hidden

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

292 files changed

+31225
-15269
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/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/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
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Backup\Controller\Adminhtml\Index;
10+
11+
use Magento\Backend\App\Action;
12+
use Magento\Backend\App\Action\Context;
13+
use Magento\Framework\View\Result\PageFactory;
14+
15+
/**
16+
* Inform that backup is disabled.
17+
*/
18+
class Disabled extends Action
19+
{
20+
/**
21+
* @see _isAllowed()
22+
*/
23+
const ADMIN_RESOURCE = 'Magento_Backend::backup';
24+
25+
/**
26+
* @var PageFactory
27+
*/
28+
private $pageFactory;
29+
30+
/**
31+
* @param Context $context
32+
* @param PageFactory $pageFactory
33+
*/
34+
public function __construct(Context $context, PageFactory $pageFactory)
35+
{
36+
parent::__construct($context);
37+
$this->pageFactory = $pageFactory;
38+
}
39+
40+
/**
41+
* @inheritDoc
42+
*/
43+
public function execute()
44+
{
45+
return $this->pageFactory->create();
46+
}
47+
}

app/code/Magento/Backup/Cron/SystemBackup.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Framework\App\Filesystem\DirectoryList;
99
use Magento\Store\Model\ScopeInterface;
1010

11+
/**
12+
* Performs scheduled backup.
13+
*/
1114
class SystemBackup
1215
{
1316
const XML_PATH_BACKUP_ENABLED = 'system/backup/enabled';
@@ -101,6 +104,10 @@ public function __construct(
101104
*/
102105
public function execute()
103106
{
107+
if (!$this->_backupData->isEnabled()) {
108+
return $this;
109+
}
110+
104111
if (!$this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_ENABLED, ScopeInterface::SCOPE_STORE)) {
105112
return $this;
106113
}

app/code/Magento/Backup/Helper/Data.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Backup\Helper;
710

811
use Magento\Framework\App\Filesystem\DirectoryList;
@@ -285,4 +288,14 @@ public function extractDataFromFilename($filename)
285288

286289
return $result;
287290
}
291+
292+
/**
293+
* Is backup functionality enabled.
294+
*
295+
* @return bool
296+
*/
297+
public function isEnabled(): bool
298+
{
299+
return $this->scopeConfig->isSetFlag('system/backup/functionality_enabled');
300+
}
288301
}

0 commit comments

Comments
 (0)