Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into BUGS
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Osadchyi committed Dec 26, 2016
2 parents 8529906 + cd637e5 commit e512fed
Show file tree
Hide file tree
Showing 202 changed files with 6,768 additions and 1,020 deletions.
3 changes: 3 additions & 0 deletions app/code/Magento/Authorizenet/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"magento/module-catalog": "101.1.*",
"magento/framework": "100.2.*"
},
"suggest": {
"magento/module-config": "100.2.*"
},
"type": "magento2-module",
"version": "100.2.0-dev",
"license": [
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Authorizenet/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@
<argument name="storage" xsi:type="object">Magento\Authorizenet\Model\Directpost\Session\Storage</argument>
</arguments>
</type>
<type name="Magento\Config\Model\Config\Export\ExcludeList">
<arguments>
<argument name="configs" xsi:type="array">
<item name="payment/authorizenet_directpost/login" xsi:type="string">1</item>
<item name="payment/authorizenet_directpost/trans_key" xsi:type="string">1</item>
<item name="payment/authorizenet_directpost/trans_md5" xsi:type="string">1</item>
<item name="payment/authorizenet_directpost/merchant_email" xsi:type="string">1</item>
</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Block\Cache\Grid\Massaction;

use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface;
use Magento\Framework\App\State;

/**
* Class checks that action can be displayed on massaction list
*/
class ProductionModeVisibilityChecker implements VisibilityCheckerInterface
{
/**
* @var State
*/
private $state;

/**
* @param State $state
*/
public function __construct(State $state)
{
$this->state = $state;
}

/**
* {@inheritdoc}
*/
public function isVisible()
{
return $this->state->getMode() !== State::MODE_PRODUCTION;
}
}
5 changes: 1 addition & 4 deletions app/code/Magento/Backend/Block/Widget/Grid/Massaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Block\Widget\Grid;

/**
* Grid widget massaction default block
*
* @author Magento Core Team <core@magentocommerce.com>
*/
namespace Magento\Backend\Block\Widget\Grid;

class Massaction extends \Magento\Backend\Block\Widget\Grid\Massaction\AbstractMassaction
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/
namespace Magento\Backend\Block\Widget\Grid\Massaction;

use Magento\Framework\View\Element\Template;
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker;
use Magento\Framework\DataObject;

/**
* Grid widget massaction block
*
* @method \Magento\Quote\Model\Quote setHideFormElement(boolean $value) Hide Form element to prevent IE errors
* @method boolean getHideFormElement()
* @author Magento Core Team <core@magentocommerce.com>
*/
abstract class AbstractMassaction extends \Magento\Backend\Block\Widget
{
Expand Down Expand Up @@ -73,20 +73,21 @@ protected function _construct()
* 'complete' => string, // Only for ajax enabled grid (optional)
* 'url' => string,
* 'confirm' => string, // text of confirmation of this action (optional)
* 'additional' => string // (optional)
* 'additional' => string, // (optional)
* 'visible' => object // instance of VisibilityCheckerInterface (optional)
* );
*
* @param string $itemId
* @param array|\Magento\Framework\DataObject $item
* @param array|DataObject $item
* @return $this
*/
public function addItem($itemId, $item)
{
if (is_array($item)) {
$item = new \Magento\Framework\DataObject($item);
$item = new DataObject($item);
}

if ($item instanceof \Magento\Framework\DataObject) {
if ($item instanceof DataObject && $this->isVisible($item)) {
$item->setId($itemId);
$item->setUrl($this->getUrl($item->getUrl()));
$this->_items[$itemId] = $item;
Expand All @@ -95,6 +96,19 @@ public function addItem($itemId, $item)
return $this;
}

/**
* Check that item can be added to list
*
* @param DataObject $item
* @return bool
*/
private function isVisible(DataObject $item)
{
/** @var VisibilityChecker $checker */
$checker = $item->getData('visible');
return (!$checker instanceof VisibilityChecker) || $checker->isVisible();
}

/**
* Retrieve massaction item with id $itemId
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Block\Widget\Grid\Massaction;

use Magento\Framework\View\Element\Block\ArgumentInterface;

interface VisibilityCheckerInterface extends ArgumentInterface
{
/**
* Check that action can be displayed on massaction list
*
* @return bool
*/
public function isVisible();
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,41 @@

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\State;
use Magento\Framework\App\ObjectManager;

/**
* Controller disables some types of cache
*/
class MassDisable extends \Magento\Backend\Controller\Adminhtml\Cache
{
/**
* @var State
*/
private $state;

/**
* Mass action for cache disabling
*
* @return \Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
{
if ($this->getState()->getMode() === State::MODE_PRODUCTION) {
$this->messageManager->addErrorMessage(__('You can\'t change status of cache type(s) in production mode'));
} else {
$this->disableCache();
}

return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('adminhtml/*');
}

/**
* Disable cache
*
* @return void
*/
private function disableCache()
{
try {
$types = $this->getRequest()->getParam('types');
Expand All @@ -41,9 +67,20 @@ public function execute()
} catch (\Exception $e) {
$this->messageManager->addException($e, __('An error occurred while disabling cache.'));
}
}

/**
* Get State Instance
*
* @return State
* @deprecated
*/
private function getState()
{
if ($this->state === null) {
$this->state = ObjectManager::getInstance()->get(State::class);
}

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
return $resultRedirect->setPath('adminhtml/*');
return $this->state;
}
}
43 changes: 40 additions & 3 deletions app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,41 @@

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\State;
use Magento\Framework\App\ObjectManager;

/**
* Controller enables some types of cache
*/
class MassEnable extends \Magento\Backend\Controller\Adminhtml\Cache
{
/**
* @var State
*/
private $state;

/**
* Mass action for cache enabling
*
* @return \Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
{
if ($this->getState()->getMode() === State::MODE_PRODUCTION) {
$this->messageManager->addErrorMessage(__('You can\'t change status of cache type(s) in production mode'));
} else {
$this->enableCache();
}

return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('adminhtml/*');
}

/**
* Enable cache
*
* @return void
*/
private function enableCache()
{
try {
$types = $this->getRequest()->getParam('types');
Expand All @@ -40,9 +66,20 @@ public function execute()
} catch (\Exception $e) {
$this->messageManager->addException($e, __('An error occurred while enabling cache.'));
}
}

/**
* Get State Instance
*
* @return State
* @deprecated
*/
private function getState()
{
if ($this->state === null) {
$this->state = ObjectManager::getInstance()->get(State::class);
}

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
return $resultRedirect->setPath('adminhtml/*');
return $this->state;
}
}
Loading

0 comments on commit e512fed

Please sign in to comment.