Skip to content

Commit 1ce84b2

Browse files
committed
MAGETWO-58701: memory_limit issue after running customer_grid indexer
2 parents 6d98e2a + c429316 commit 1ce84b2

File tree

897 files changed

+30724
-10228
lines changed

Some content is hidden

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

897 files changed

+30724
-10228
lines changed

app/code/Magento/Authorizenet/Model/Authorizenet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ protected function buildRequest(\Magento\Framework\DataObject $payment)
332332
->setXCity($billing->getCity())
333333
->setXState($billing->getRegion())
334334
->setXZip($billing->getPostcode())
335-
->setXCountry($billing->getCountry())
335+
->setXCountry($billing->getCountryId())
336336
->setXPhone($billing->getTelephone())
337337
->setXFax($billing->getFax())
338338
->setXCustId($order->getCustomerId())
@@ -352,7 +352,7 @@ protected function buildRequest(\Magento\Framework\DataObject $payment)
352352
->setXShipToCity($shipping->getCity())
353353
->setXShipToState($shipping->getRegion())
354354
->setXShipToZip($shipping->getPostcode())
355-
->setXShipToCountry($shipping->getCountry());
355+
->setXShipToCountry($shipping->getCountryId());
356356
}
357357

358358
$request->setXPoNum($payment->getPoNumber())

app/code/Magento/Authorizenet/Model/Directpost/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function setDataFromOrder(
123123
->setXCity(strval($billing->getCity()))
124124
->setXState(strval($billing->getRegion()))
125125
->setXZip(strval($billing->getPostcode()))
126-
->setXCountry(strval($billing->getCountry()))
126+
->setXCountry(strval($billing->getCountryId()))
127127
->setXPhone(strval($billing->getTelephone()))
128128
->setXFax(strval($billing->getFax()))
129129
->setXCustId(strval($billing->getCustomerId()))
@@ -151,7 +151,7 @@ public function setDataFromOrder(
151151
)->setXShipToZip(
152152
strval($shipping->getPostcode())
153153
)->setXShipToCountry(
154-
strval($shipping->getCountry())
154+
strval($shipping->getCountryId())
155155
);
156156
}
157157

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>

app/code/Magento/Backend/App/Config.php

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,66 @@
1010

1111
namespace Magento\Backend\App;
1212

13+
use Magento\Config\App\Config\Type\System;
1314
use Magento\Framework\App\Config\ScopeConfigInterface;
1415

1516
/**
16-
* Backend config accessor
17+
* Backend config accessor.
1718
*/
1819
class Config implements ConfigInterface
1920
{
2021
/**
21-
* @var \Magento\Framework\App\Config\ScopePool
22+
* @var \Magento\Framework\App\Config
2223
*/
23-
protected $_scopePool;
24+
protected $appConfig;
2425

2526
/**
26-
* @param \Magento\Framework\App\Config\ScopePool $scopePool
27+
* @var array
2728
*/
28-
public function __construct(\Magento\Framework\App\Config\ScopePool $scopePool)
29+
private $data;
30+
31+
/**
32+
* @param \Magento\Framework\App\Config $appConfig
33+
* @return void
34+
*/
35+
public function __construct(\Magento\Framework\App\Config $appConfig)
2936
{
30-
$this->_scopePool = $scopePool;
37+
$this->appConfig = $appConfig;
3138
}
3239

3340
/**
34-
* Retrieve config value by path and scope
35-
*
36-
* @param string $path
37-
* @return mixed
41+
* @inheritdoc
3842
*/
3943
public function getValue($path)
4044
{
41-
return $this->_scopePool->getScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null)->getValue($path);
45+
if (isset($this->data[$path])) {
46+
return $this->data[$path];
47+
}
48+
49+
$configPath = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
50+
if ($path) {
51+
$configPath .= '/' . $path;
52+
}
53+
return $this->appConfig->get(System::CONFIG_TYPE, $configPath);
4254
}
4355

4456
/**
45-
* Set config value in the corresponding config scope
46-
*
47-
* @param string $path
48-
* @param mixed $value
49-
* @return void
57+
* @inheritdoc
5058
*/
5159
public function setValue($path, $value)
5260
{
53-
$this->_scopePool->getScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null)->setValue($path, $value);
61+
$this->data[$path] = $value;
5462
}
5563

5664
/**
57-
* Retrieve config flag
58-
*
59-
* @param string $path
60-
* @return bool
65+
* @inheritdoc
6166
*/
6267
public function isSetFlag($path)
6368
{
64-
return !!$this->_scopePool->getScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null)->getValue($path);
69+
$configPath = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
70+
if ($path) {
71+
$configPath .= '/' . $path;
72+
}
73+
return (bool) $this->appConfig->get(System::CONFIG_TYPE, $configPath);
6574
}
6675
}

app/code/Magento/Backend/App/ConfigInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface ConfigInterface
1515
/**
1616
* Retrieve config value by path
1717
*
18+
* Path should looks like keys imploded by "/". For example scopes/stores/admin
19+
*
1820
* @param string $path
1921
* @return mixed
2022
* @api
@@ -24,6 +26,7 @@ public function getValue($path);
2426
/**
2527
* Set config value
2628
*
29+
* @deprecated
2730
* @param string $path
2831
* @param mixed $value
2932
* @return void
@@ -34,6 +37,8 @@ public function setValue($path, $value);
3437
/**
3538
* Retrieve config flag
3639
*
40+
* Path should looks like keys imploded by "/". For example scopes/stores/admin
41+
*
3742
* @param string $path
3843
* @return bool
3944
* @api
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/Column/Renderer/Text.php

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
7+
8+
use Magento\Framework\DataObject;
69

710
/**
811
* Backend grid item renderer
9-
*
10-
* @author Magento Core Team <[email protected]>
1112
*/
12-
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
13-
1413
class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
1514
{
1615
/**
@@ -21,30 +20,53 @@ class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe
2120
protected $_variablePattern = '/\\$([a-z0-9_]+)/i';
2221

2322
/**
24-
* Renders grid column
23+
* Get value for the cel
2524
*
26-
* @param \Magento\Framework\DataObject $row
27-
* @return mixed
25+
* @param DataObject $row
26+
* @return string
2827
*/
29-
public function _getValue(\Magento\Framework\DataObject $row)
28+
public function _getValue(DataObject $row)
3029
{
31-
$format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null;
32-
$defaultValue = $this->getColumn()->getDefault();
33-
if ($format === null) {
34-
// If no format and it column not filtered specified return data as is.
35-
$data = parent::_getValue($row);
36-
$string = $data === null ? $defaultValue : $data;
37-
return $this->escapeHtml($string);
38-
} elseif (preg_match_all($this->_variablePattern, $format, $matches)) {
39-
// Parsing of format string
40-
$formattedString = $format;
41-
foreach ($matches[0] as $matchIndex => $match) {
42-
$value = $row->getData($matches[1][$matchIndex]);
43-
$formattedString = str_replace($match, $value, $formattedString);
30+
if (null === $this->getColumn()->getFormat()) {
31+
return $this->getSimpleValue($row);
32+
}
33+
return $this->getFormattedValue($row);
34+
}
35+
36+
/**
37+
* Get simple value
38+
*
39+
* @param DataObject $row
40+
* @return string
41+
*/
42+
private function getSimpleValue(DataObject $row)
43+
{
44+
$data = parent::_getValue($row);
45+
$value = null === $data ? $this->getColumn()->getDefault() : $data;
46+
if (true === $this->getColumn()->getTranslate()) {
47+
$value = __($value);
48+
}
49+
return $this->escapeHtml($value);
50+
}
51+
52+
/**
53+
* Replace placeholders in the string with values
54+
*
55+
* @param DataObject $row
56+
* @return string
57+
*/
58+
private function getFormattedValue(DataObject $row)
59+
{
60+
$value = $this->getColumn()->getFormat() ?: null;
61+
if (true === $this->getColumn()->getTranslate()) {
62+
$value = __($value);
63+
}
64+
if (preg_match_all($this->_variablePattern, $value, $matches)) {
65+
foreach ($matches[0] as $index => $match) {
66+
$replacement = $row->getData($matches[1][$index]);
67+
$value = str_replace($match, $replacement, $value);
4468
}
45-
return $formattedString;
46-
} else {
47-
return $this->escapeHtml($format);
4869
}
70+
return $this->escapeHtml($value);
4971
}
5072
}

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 <[email protected]>
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 <[email protected]>
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
*

0 commit comments

Comments
 (0)