Skip to content

Commit 7b76e12

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-60420-remove-unserialize-from-menu
2 parents a859802 + b5b1a66 commit 7b76e12

File tree

300 files changed

+9218
-1619
lines changed

Some content is hidden

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

300 files changed

+9218
-1619
lines changed

app/code/Magento/Authorizenet/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"magento/module-catalog": "101.1.*",
1313
"magento/framework": "100.2.*"
1414
},
15+
"suggest": {
16+
"magento/module-config": "100.2.*"
17+
},
1518
"type": "magento2-module",
1619
"version": "100.2.0-dev",
1720
"license": [

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@
1616
<argument name="storage" xsi:type="object">Magento\Authorizenet\Model\Directpost\Session\Storage</argument>
1717
</arguments>
1818
</type>
19+
<type name="Magento\Config\Model\Config\Export\ExcludeList">
20+
<arguments>
21+
<argument name="configs" xsi:type="array">
22+
<item name="payment/authorizenet_directpost/login" xsi:type="string">1</item>
23+
<item name="payment/authorizenet_directpost/trans_key" xsi:type="string">1</item>
24+
<item name="payment/authorizenet_directpost/trans_md5" xsi:type="string">1</item>
25+
<item name="payment/authorizenet_directpost/merchant_email" xsi:type="string">1</item>
26+
</argument>
27+
</arguments>
28+
</type>
1929
</config>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Backend\Block\Cache\Grid\Massaction;
7+
8+
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface;
9+
use Magento\Framework\App\State;
10+
11+
/**
12+
* Class checks that action can be displayed on massaction list
13+
*/
14+
class ProductionModeVisibilityChecker implements VisibilityCheckerInterface
15+
{
16+
/**
17+
* @var State
18+
*/
19+
private $state;
20+
21+
/**
22+
* @param State $state
23+
*/
24+
public function __construct(State $state)
25+
{
26+
$this->state = $state;
27+
}
28+
29+
/**
30+
* {@inheritdoc}
31+
*/
32+
public function isVisible()
33+
{
34+
return $this->state->getMode() !== State::MODE_PRODUCTION;
35+
}
36+
}

app/code/Magento/Backend/Block/Widget/Grid/Massaction.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
namespace Magento\Backend\Block\Widget\Grid;
67

78
/**
89
* Grid widget massaction default block
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
1110
*/
12-
namespace Magento\Backend\Block\Widget\Grid;
13-
1411
class Massaction extends \Magento\Backend\Block\Widget\Grid\Massaction\AbstractMassaction
1512
{
1613
}

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66
namespace Magento\Backend\Block\Widget\Grid\Massaction;
77

8-
use Magento\Framework\View\Element\Template;
8+
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker;
9+
use Magento\Framework\DataObject;
910

1011
/**
1112
* Grid widget massaction block
1213
*
1314
* @method \Magento\Quote\Model\Quote setHideFormElement(boolean $value) Hide Form element to prevent IE errors
1415
* @method boolean getHideFormElement()
15-
* @author Magento Core Team <core@magentocommerce.com>
1616
*/
1717
abstract class AbstractMassaction extends \Magento\Backend\Block\Widget
1818
{
@@ -73,20 +73,21 @@ protected function _construct()
7373
* 'complete' => string, // Only for ajax enabled grid (optional)
7474
* 'url' => string,
7575
* 'confirm' => string, // text of confirmation of this action (optional)
76-
* 'additional' => string // (optional)
76+
* 'additional' => string, // (optional)
77+
* 'visible' => object // instance of VisibilityCheckerInterface (optional)
7778
* );
7879
*
7980
* @param string $itemId
80-
* @param array|\Magento\Framework\DataObject $item
81+
* @param array|DataObject $item
8182
* @return $this
8283
*/
8384
public function addItem($itemId, $item)
8485
{
8586
if (is_array($item)) {
86-
$item = new \Magento\Framework\DataObject($item);
87+
$item = new DataObject($item);
8788
}
8889

89-
if ($item instanceof \Magento\Framework\DataObject) {
90+
if ($item instanceof DataObject && $this->isVisible($item)) {
9091
$item->setId($itemId);
9192
$item->setUrl($this->getUrl($item->getUrl()));
9293
$this->_items[$itemId] = $item;
@@ -95,6 +96,19 @@ public function addItem($itemId, $item)
9596
return $this;
9697
}
9798

99+
/**
100+
* Check that item can be added to list
101+
*
102+
* @param DataObject $item
103+
* @return bool
104+
*/
105+
private function isVisible(DataObject $item)
106+
{
107+
/** @var VisibilityChecker $checker */
108+
$checker = $item->getData('visible');
109+
return (!$checker instanceof VisibilityChecker) || $checker->isVisible();
110+
}
111+
98112
/**
99113
* Retrieve massaction item with id $itemId
100114
*
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Backend\Block\Widget\Grid\Massaction;
7+
8+
use Magento\Framework\View\Element\Block\ArgumentInterface;
9+
10+
interface VisibilityCheckerInterface extends ArgumentInterface
11+
{
12+
/**
13+
* Check that action can be displayed on massaction list
14+
*
15+
* @return bool
16+
*/
17+
public function isVisible();
18+
}

app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,41 @@
88

99
use Magento\Framework\Exception\LocalizedException;
1010
use Magento\Framework\Controller\ResultFactory;
11+
use Magento\Framework\App\State;
12+
use Magento\Framework\App\ObjectManager;
1113

14+
/**
15+
* Controller disables some types of cache
16+
*/
1217
class MassDisable extends \Magento\Backend\Controller\Adminhtml\Cache
1318
{
19+
/**
20+
* @var State
21+
*/
22+
private $state;
23+
1424
/**
1525
* Mass action for cache disabling
1626
*
1727
* @return \Magento\Backend\Model\View\Result\Redirect
1828
*/
1929
public function execute()
30+
{
31+
if ($this->getState()->getMode() === State::MODE_PRODUCTION) {
32+
$this->messageManager->addErrorMessage(__('You can\'t change status of cache type(s) in production mode'));
33+
} else {
34+
$this->disableCache();
35+
}
36+
37+
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('adminhtml/*');
38+
}
39+
40+
/**
41+
* Disable cache
42+
*
43+
* @return void
44+
*/
45+
private function disableCache()
2046
{
2147
try {
2248
$types = $this->getRequest()->getParam('types');
@@ -41,9 +67,20 @@ public function execute()
4167
} catch (\Exception $e) {
4268
$this->messageManager->addException($e, __('An error occurred while disabling cache.'));
4369
}
70+
}
71+
72+
/**
73+
* Get State Instance
74+
*
75+
* @return State
76+
* @deprecated
77+
*/
78+
private function getState()
79+
{
80+
if ($this->state === null) {
81+
$this->state = ObjectManager::getInstance()->get(State::class);
82+
}
4483

45-
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
46-
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
47-
return $resultRedirect->setPath('adminhtml/*');
84+
return $this->state;
4885
}
4986
}

app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,41 @@
88

99
use Magento\Framework\Exception\LocalizedException;
1010
use Magento\Framework\Controller\ResultFactory;
11+
use Magento\Framework\App\State;
12+
use Magento\Framework\App\ObjectManager;
1113

14+
/**
15+
* Controller enables some types of cache
16+
*/
1217
class MassEnable extends \Magento\Backend\Controller\Adminhtml\Cache
1318
{
19+
/**
20+
* @var State
21+
*/
22+
private $state;
23+
1424
/**
1525
* Mass action for cache enabling
1626
*
1727
* @return \Magento\Backend\Model\View\Result\Redirect
1828
*/
1929
public function execute()
30+
{
31+
if ($this->getState()->getMode() === State::MODE_PRODUCTION) {
32+
$this->messageManager->addErrorMessage(__('You can\'t change status of cache type(s) in production mode'));
33+
} else {
34+
$this->enableCache();
35+
}
36+
37+
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('adminhtml/*');
38+
}
39+
40+
/**
41+
* Enable cache
42+
*
43+
* @return void
44+
*/
45+
private function enableCache()
2046
{
2147
try {
2248
$types = $this->getRequest()->getParam('types');
@@ -40,9 +66,20 @@ public function execute()
4066
} catch (\Exception $e) {
4167
$this->messageManager->addException($e, __('An error occurred while enabling cache.'));
4268
}
69+
}
70+
71+
/**
72+
* Get State Instance
73+
*
74+
* @return State
75+
* @deprecated
76+
*/
77+
private function getState()
78+
{
79+
if ($this->state === null) {
80+
$this->state = ObjectManager::getInstance()->get(State::class);
81+
}
4382

44-
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
45-
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
46-
return $resultRedirect->setPath('adminhtml/*');
83+
return $this->state;
4784
}
4885
}

0 commit comments

Comments
 (0)