Skip to content

Commit

Permalink
Merge pull request magento#3502 from magento-plankton/2.2-develop-mer…
Browse files Browse the repository at this point in the history
…ge-2.2.7

[Plankton] MAGETWO-95168 Magento 2.2.7 Publication
  • Loading branch information
xmav authored Dec 5, 2018
2 parents a72f59b + 8e455b9 commit 8c6000f
Show file tree
Hide file tree
Showing 292 changed files with 31,225 additions and 15,269 deletions.
147 changes: 147 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
"version": "100.2.4",
"version": "100.2.5",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedPricingImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"magento/framework": "101.0.*"
},
"type": "magento2-module",
"version": "100.2.4",
"version": "100.2.5",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"magento/framework": "101.0.*"
},
"type": "magento2-module",
"version": "100.2.3",
"version": "100.2.4",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorization/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"magento/framework": "101.0.*"
},
"type": "magento2-module",
"version": "100.2.2",
"version": "100.2.3",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorizenet/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"magento/module-config": "101.0.*"
},
"type": "magento2-module",
"version": "100.2.2",
"version": "100.2.3",
"license": [
"proprietary"
],
Expand Down
38 changes: 35 additions & 3 deletions app/code/Magento/Backend/Block/System/Store/Delete/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,39 @@
*/
namespace Magento\Backend\Block\System\Store\Delete;

use Magento\Backup\Helper\Data as BackupHelper;
use Magento\Framework\App\ObjectManager;

/**
* Adminhtml cms block edit form
*
* @author Magento Core Team <core@magentocommerce.com>
*/
class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
* @var BackupHelper
*/
private $backup;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Data\FormFactory $formFactory
* @param array $data
* @param BackupHelper|null $backup
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
array $data = [],
BackupHelper $backup = null
) {
parent::__construct($context, $registry, $formFactory, $data);
$this->backup = $backup ?? ObjectManager::getInstance()->get(BackupHelper::class);
}

/**
* Init form
*
Expand All @@ -25,7 +51,7 @@ protected function _construct()
}

/**
* {@inheritdoc}
* @inheritDoc
*/
protected function _prepareForm()
{
Expand All @@ -45,15 +71,21 @@ protected function _prepareForm()

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

$backupOptions = ['0' => __('No')];
$backupSelected = '0';
if ($this->backup->isEnabled()) {
$backupOptions['1'] = __('Yes');
$backupSelected = '1';
}
$fieldset->addField(
'create_backup',
'select',
[
'label' => __('Create DB Backup'),
'title' => __('Create DB Backup'),
'name' => 'create_backup',
'options' => ['1' => __('Yes'), '0' => __('No')],
'value' => '1'
'options' => $backupOptions,
'value' => $backupSelected
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Store controller
*
* @author Magento Core Team <core@magentocommerce.com>
* @SuppressWarnings(PHPMD.AllPurposeAction)
*/
abstract class Store extends Action
{
Expand Down Expand Up @@ -86,6 +87,8 @@ protected function createPage()
* Backup database
*
* @return bool
*
* @deprecated Backup module is to be removed.
*/
protected function _backupDatabase()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
<element name="test" type="input" selector=".test"/>
<element name="success" type="text" selector="#messages div.message-success"/>
<element name="successMessageByIndex" type="text" selector=".message.message-success.success:nth-of-type({{n}})>div" parameterized="true"/>
<element name="error" type="text" selector="#messages div.message-error"/>
</section>
</sections>
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"magento/module-theme": "100.2.*"
},
"type": "magento2-module",
"version": "100.2.6",
"version": "100.2.7",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
26 changes: 25 additions & 1 deletion app/code/Magento/Backup/Controller/Adminhtml/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
*/
namespace Magento\Backup\Controller\Adminhtml;

use Magento\Backup\Helper\Data as Helper;
use Magento\Framework\App\ObjectManager;

/**
* Backup admin controller
*
* @author Magento Core Team <core@magentocommerce.com>
* @api
* @since 100.0.2
* @SuppressWarnings(PHPMD.AllPurposeAction)
*/
abstract class Index extends \Magento\Backend\App\Action
{
Expand Down Expand Up @@ -48,27 +52,47 @@ abstract class Index extends \Magento\Backend\App\Action
*/
protected $maintenanceMode;

/**
* @var Helper
*/
private $helper;

/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\Backup\Factory $backupFactory
* @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
* @param \Magento\Backup\Model\BackupFactory $backupModelFactory
* @param \Magento\Framework\App\MaintenanceMode $maintenanceMode
* @param Helper|null $helper
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\Backup\Factory $backupFactory,
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
\Magento\Backup\Model\BackupFactory $backupModelFactory,
\Magento\Framework\App\MaintenanceMode $maintenanceMode
\Magento\Framework\App\MaintenanceMode $maintenanceMode,
Helper $helper = null
) {
$this->_coreRegistry = $coreRegistry;
$this->_backupFactory = $backupFactory;
$this->_fileFactory = $fileFactory;
$this->_backupModelFactory = $backupModelFactory;
$this->maintenanceMode = $maintenanceMode;
$this->helper = $helper ?? ObjectManager::getInstance()->get(Helper::class);
parent::__construct($context);
}

/**
* @inheritDoc
*/
public function dispatch(\Magento\Framework\App\RequestInterface $request)
{
if (!$this->helper->isEnabled()) {
return $this->_redirect('*/*/disabled');
}

return parent::dispatch($request);
}
}
47 changes: 47 additions & 0 deletions app/code/Magento/Backup/Controller/Adminhtml/Index/Disabled.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Backup\Controller\Adminhtml\Index;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;

/**
* Inform that backup is disabled.
*/
class Disabled extends Action
{
/**
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'Magento_Backend::backup';

/**
* @var PageFactory
*/
private $pageFactory;

/**
* @param Context $context
* @param PageFactory $pageFactory
*/
public function __construct(Context $context, PageFactory $pageFactory)
{
parent::__construct($context);
$this->pageFactory = $pageFactory;
}

/**
* @inheritDoc
*/
public function execute()
{
return $this->pageFactory->create();
}
}
7 changes: 7 additions & 0 deletions app/code/Magento/Backup/Cron/SystemBackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Store\Model\ScopeInterface;

/**
* Performs scheduled backup.
*/
class SystemBackup
{
const XML_PATH_BACKUP_ENABLED = 'system/backup/enabled';
Expand Down Expand Up @@ -101,6 +104,10 @@ public function __construct(
*/
public function execute()
{
if (!$this->_backupData->isEnabled()) {
return $this;
}

if (!$this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_ENABLED, ScopeInterface::SCOPE_STORE)) {
return $this;
}
Expand Down
13 changes: 13 additions & 0 deletions app/code/Magento/Backup/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Backup\Helper;

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

return $result;
}

/**
* Is backup functionality enabled.
*
* @return bool
*/
public function isEnabled(): bool
{
return $this->scopeConfig->isSetFlag('system/backup/functionality_enabled');
}
}
Loading

0 comments on commit 8c6000f

Please sign in to comment.