Skip to content

Commit 5899dc1

Browse files
author
olysenko
committed
Merge remote-tracking branch 'mainline/2.2-develop' into pr1
2 parents f587cf0 + 00c6b48 commit 5899dc1

File tree

53 files changed

+436
-74
lines changed

Some content is hidden

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

53 files changed

+436
-74
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request)
217217
$this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false);
218218
$this->_view->renderLayout();
219219
$this->_request->setDispatched(true);
220+
220221
return $this->_response;
221222
}
222223

@@ -226,6 +227,11 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request)
226227

227228
$this->_processLocaleSettings();
228229

230+
// Need to preload isFirstPageAfterLogin (see https://github.com/magento/magento2/issues/15510)
231+
if ($this->_auth->isLoggedIn()) {
232+
$this->_auth->getAuthStorage()->isFirstPageAfterLogin();
233+
}
234+
229235
return parent::dispatch($request);
230236
}
231237

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ public function __construct(
6868
$this->_storeManager = $storeManager;
6969
$this->_currencyLocator = $currencyLocator;
7070
$this->_localeCurrency = $localeCurrency;
71-
$defaultBaseCurrencyCode = $this->_scopeConfig->getValue(
72-
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
73-
'default'
74-
);
71+
$defaultBaseCurrencyCode = $currencyLocator->getDefaultCurrency($this->_request);
7572
$this->_defaultBaseCurrency = $currencyFactory->create()->load($defaultBaseCurrencyCode);
7673
}
7774

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Checkbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Checkbox extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Op
1717
/**
1818
* @var string
1919
*/
20-
protected $_template = 'product/composite/fieldset/options/type/checkbox.phtml';
20+
protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/checkbox.phtml';
2121

2222
/**
2323
* @param string $elementId

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Multi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Multi extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio
1717
/**
1818
* @var string
1919
*/
20-
protected $_template = 'product/composite/fieldset/options/type/multi.phtml';
20+
protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/multi.phtml';
2121

2222
/**
2323
* @param string $elementId

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Radio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Radio extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio
1717
/**
1818
* @var string
1919
*/
20-
protected $_template = 'product/composite/fieldset/options/type/radio.phtml';
20+
protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/radio.phtml';
2121

2222
/**
2323
* @param string $elementId

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Select.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Select extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Opti
1717
/**
1818
* @var string
1919
*/
20-
protected $_template = 'product/composite/fieldset/options/type/select.phtml';
20+
protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/select.phtml';
2121

2222
/**
2323
* @param string $elementId

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Bundle extends \Magento\Backend\Block\Widget implements \Magento\Backend\B
2020
/**
2121
* @var string
2222
*/
23-
protected $_template = 'product/edit/bundle.phtml';
23+
protected $_template = 'Magento_Bundle::product/edit/bundle.phtml';
2424

2525
/**
2626
* Core registry

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Option extends \Magento\Backend\Block\Widget
2626
/**
2727
* @var string
2828
*/
29-
protected $_template = 'product/edit/bundle/option.phtml';
29+
protected $_template = 'Magento_Bundle::product/edit/bundle/option.phtml';
3030

3131
/**
3232
* Core registry

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Search extends \Magento\Backend\Block\Widget
1515
/**
1616
* @var string
1717
*/
18-
protected $_template = 'product/edit/bundle/option/search.phtml';
18+
protected $_template = 'Magento_Bundle::product/edit/bundle/option/search.phtml';
1919

2020
/**
2121
* @return void

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Selection extends \Magento\Backend\Block\Widget
1515
/**
1616
* @var string
1717
*/
18-
protected $_template = 'product/edit/bundle/option/selection.phtml';
18+
protected $_template = 'Magento_Bundle::product/edit/bundle/option/selection.phtml';
1919

2020
/**
2121
* Catalog data

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ class Checkbox extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Op
1616
/**
1717
* @var string
1818
*/
19-
protected $_template = 'catalog/product/view/type/bundle/option/checkbox.phtml';
19+
protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/checkbox.phtml';
2020
}

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Multi extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio
1616
/**
1717
* @var string
1818
*/
19-
protected $_template = 'catalog/product/view/type/bundle/option/multi.phtml';
19+
protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/multi.phtml';
2020

2121
/**
2222
* @inheritdoc

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ class Radio extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio
1616
/**
1717
* @var string
1818
*/
19-
protected $_template = 'catalog/product/view/type/bundle/option/radio.phtml';
19+
protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/radio.phtml';
2020
}

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ class Select extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Opti
1616
/**
1717
* @var string
1818
*/
19-
protected $_template = 'catalog/product/view/type/bundle/option/select.phtml';
19+
protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/select.phtml';
2020
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function __construct(
6161
* @param int|null $id
6262
* @return \Magento\Catalog\Model\Indexer\Product\Flat\Action\Row
6363
* @throws \Magento\Framework\Exception\LocalizedException
64+
* @throws \Zend_Db_Statement_Exception
6465
*/
6566
public function execute($id = null)
6667
{
@@ -75,17 +76,43 @@ public function execute($id = null)
7576
if ($tableExists) {
7677
$this->flatItemEraser->removeDeletedProducts($ids, $store->getId());
7778
}
78-
if (isset($ids[0])) {
79-
if (!$tableExists) {
80-
$this->_flatTableBuilder->build(
81-
$store->getId(),
82-
[$ids[0]],
83-
$this->_valueFieldSuffix,
84-
$this->_tableDropSuffix,
85-
false
86-
);
79+
80+
/* @var $status \Magento\Eav\Model\Entity\Attribute */
81+
$status = $this->_productIndexerHelper->getAttribute('status');
82+
$statusTable = $status->getBackend()->getTable();
83+
$statusConditions = [
84+
'store_id IN(0,' . (int)$store->getId() . ')',
85+
'attribute_id = ' . (int)$status->getId(),
86+
'entity_id = ' . (int)$id
87+
];
88+
$select = $this->_connection->select();
89+
$select->from(
90+
$statusTable,
91+
['value']
92+
)->where(
93+
implode(' AND ', $statusConditions)
94+
)->order(
95+
'store_id DESC'
96+
);
97+
$result = $this->_connection->query($select);
98+
$status = $result->fetch(1);
99+
100+
if ($status['value'] == \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) {
101+
if (isset($ids[0])) {
102+
if (!$tableExists) {
103+
$this->_flatTableBuilder->build(
104+
$store->getId(),
105+
[$ids[0]],
106+
$this->_valueFieldSuffix,
107+
$this->_tableDropSuffix,
108+
false
109+
);
110+
}
111+
$this->flatItemWriter->write($store->getId(), $ids[0], $this->_valueFieldSuffix);
87112
}
88-
$this->flatItemWriter->write($store->getId(), $ids[0], $this->_valueFieldSuffix);
113+
}
114+
if ($status['value'] == \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED) {
115+
$this->flatItemEraser->deleteProductsFromStore($id, $store->getId());
89116
}
90117
}
91118
return $this;

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/RowTest.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1212

13+
/**
14+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
15+
*/
1316
class RowTest extends \PHPUnit\Framework\TestCase
1417
{
1518
/**
@@ -61,6 +64,8 @@ protected function setUp()
6164
{
6265
$objectManager = new ObjectManager($this);
6366

67+
$attributeTable = 'catalog_product_entity_int';
68+
$statusId = 22;
6469
$this->connection = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class);
6570
$this->resource = $this->createMock(\Magento\Framework\App\ResourceConnection::class);
6671
$this->resource->expects($this->any())->method('getConnection')
@@ -70,10 +75,36 @@ protected function setUp()
7075
$this->store = $this->createMock(\Magento\Store\Model\Store::class);
7176
$this->store->expects($this->any())->method('getId')->will($this->returnValue('store_id_1'));
7277
$this->storeManager->expects($this->any())->method('getStores')->will($this->returnValue([$this->store]));
73-
$this->productIndexerHelper = $this->createMock(\Magento\Catalog\Helper\Product\Flat\Indexer::class);
7478
$this->flatItemEraser = $this->createMock(\Magento\Catalog\Model\Indexer\Product\Flat\Action\Eraser::class);
7579
$this->flatItemWriter = $this->createMock(\Magento\Catalog\Model\Indexer\Product\Flat\Action\Indexer::class);
7680
$this->flatTableBuilder = $this->createMock(\Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder::class);
81+
$this->productIndexerHelper = $this->createMock(\Magento\Catalog\Helper\Product\Flat\Indexer::class);
82+
$statusAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class)
83+
->disableOriginalConstructor()
84+
->getMock();
85+
$this->productIndexerHelper->expects($this->any())->method('getAttribute')
86+
->with('status')
87+
->willReturn($statusAttributeMock);
88+
$backendMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend::class)
89+
->disableOriginalConstructor()
90+
->getMock();
91+
$backendMock->expects($this->any())->method('getTable')->willReturn($attributeTable);
92+
$statusAttributeMock->expects($this->any())->method('getBackend')->willReturn(
93+
$backendMock
94+
);
95+
$statusAttributeMock->expects($this->any())->method('getId')->willReturn($statusId);
96+
$selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
97+
->disableOriginalConstructor()
98+
->getMock();
99+
$this->connection->expects($this->any())->method('select')->willReturn($selectMock);
100+
$selectMock->expects($this->any())->method('from')->with(
101+
$attributeTable,
102+
['value']
103+
)->willReturnSelf();
104+
$selectMock->expects($this->any())->method('where')->willReturnSelf();
105+
$pdoMock = $this->createMock(\Zend_Db_Statement_Pdo::class);
106+
$this->connection->expects($this->any())->method('query')->with($selectMock)->will($this->returnValue($pdoMock));
107+
$pdoMock->expects($this->any())->method('fetch')->will($this->returnValue(['value' => 1]));
77108

78109
$this->model = $objectManager->getObject(
79110
\Magento\Catalog\Model\Indexer\Product\Flat\Action\Row::class, [
@@ -82,7 +113,7 @@ protected function setUp()
82113
'productHelper' => $this->productIndexerHelper,
83114
'flatItemEraser' => $this->flatItemEraser,
84115
'flatItemWriter' => $this->flatItemWriter,
85-
'flatTableBuilder' => $this->flatTableBuilder
116+
'flatTableBuilder' => $this->flatTableBuilder,
86117
]);
87118
}
88119

app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@
3030
<span class="count" if="maxItemsToDisplay < getCartLineItemsCount()" text="maxItemsToDisplay"/>
3131
<translate args="'of'" if="maxItemsToDisplay < getCartLineItemsCount()"/>
3232
<span class="count" text="getCartLineItemsCount()"/>
33-
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
34-
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
33+
<!-- ko if: (getCartLineItemsCount() === 1) -->
34+
<span translate="'Item in Cart'"/>
35+
<!--/ko-->
36+
<!-- ko if: (getCartLineItemsCount() > 1) -->
37+
<span translate="'Items in Cart'"/>
38+
<!--/ko-->
3539
</div>
3640

3741
<each args="getRegion('subtotalContainer')" render=""/>

app/code/Magento/Contact/Controller/Index/Post.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Magento\Framework\App\Request\DataPersistorInterface;
1313
use Magento\Framework\Controller\Result\Redirect;
1414
use Magento\Framework\Exception\LocalizedException;
15-
use Magento\Framework\HTTP\PhpEnvironment\Request;
1615
use Psr\Log\LoggerInterface;
1716
use Magento\Framework\App\ObjectManager;
1817
use Magento\Framework\DataObject;
@@ -67,7 +66,7 @@ public function __construct(
6766
*/
6867
public function execute()
6968
{
70-
if (!$this->isPostRequest()) {
69+
if (!$this->getRequest()->isPost()) {
7170
return $this->resultRedirectFactory->create()->setPath('*/*/');
7271
}
7372
try {
@@ -101,16 +100,6 @@ private function sendEmail($post)
101100
);
102101
}
103102

104-
/**
105-
* @return bool
106-
*/
107-
private function isPostRequest()
108-
{
109-
/** @var Request $request */
110-
$request = $this->getRequest();
111-
return !empty($request->getPostValue());
112-
}
113-
114103
/**
115104
* @return array
116105
* @throws \Exception

app/code/Magento/Contact/Test/Unit/Controller/Index/PostTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function setUp()
7878
$this->createMock(\Magento\Framework\Message\ManagerInterface::class);
7979
$this->requestStub = $this->createPartialMock(
8080
\Magento\Framework\App\Request\Http::class,
81-
['getPostValue', 'getParams', 'getParam']
81+
['getPostValue', 'getParams', 'getParam', 'isPost']
8282
);
8383
$this->redirectResultMock = $this->createMock(\Magento\Framework\Controller\Result\Redirect::class);
8484
$this->redirectResultMock->method('setPath')->willReturnSelf();
@@ -174,6 +174,10 @@ public function testExecuteValidPost()
174174
*/
175175
private function stubRequestPostData($post)
176176
{
177+
$this->requestStub
178+
->expects($this->once())
179+
->method('isPost')
180+
->willReturn(!empty($post));
177181
$this->requestStub->method('getPostValue')->willReturn($post);
178182
$this->requestStub->method('getParams')->willReturn($post);
179183
$this->requestStub->method('getParam')->willReturnCallback(

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,19 @@
340340
<virtualType name="Magento\Customer\Model\Api\SearchCriteria\CollectionProcessor\GroupFilterProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor">
341341
<arguments>
342342
<argument name="fieldMapping" xsi:type="array">
343-
<item name="code" xsi:type="string">customer_group_code</item>
344-
<item name="id" xsi:type="string">customer_group_id</item>
345-
<item name="tax_class_name" xsi:type="string">class_name</item>
343+
<item name="code" xsi:type="string">main_table.customer_group_code</item>
344+
<item name="id" xsi:type="string">main_table.customer_group_id</item>
345+
<item name="tax_class_name" xsi:type="string">tax_class_table.class_name</item>
346346
</argument>
347347
</arguments>
348348
</virtualType>
349349
<!-- @api -->
350350
<virtualType name="Magento\Customer\Model\Api\SearchCriteria\CollectionProcessor\GroupSortingProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor">
351351
<arguments>
352352
<argument name="fieldMapping" xsi:type="array">
353-
<item name="code" xsi:type="string">customer_group_code</item>
354-
<item name="id" xsi:type="string">customer_group_id</item>
355-
<item name="tax_class_name" xsi:type="string">class_name</item>
353+
<item name="code" xsi:type="string">main_table.customer_group_code</item>
354+
<item name="id" xsi:type="string">main_table.customer_group_id</item>
355+
<item name="tax_class_name" xsi:type="string">tax_class_table.class_name</item>
356356
</argument>
357357
<argument name="defaultOrders" xsi:type="array">
358358
<item name="id" xsi:type="string">ASC</item>

app/code/Magento/NewRelicReporting/Model/Config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ public function getNewRelicAppName()
161161
return (string)$this->scopeConfig->getValue('newrelicreporting/general/app_name');
162162
}
163163

164+
/**
165+
* Returns configured separate apps value
166+
*
167+
* @return bool
168+
*/
169+
public function isSeparateApps()
170+
{
171+
return (bool)$this->scopeConfig->getValue('newrelicreporting/general/separate_apps');
172+
}
173+
164174
/**
165175
* Returns config setting for overall cron to be enabled
166176
*

app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ public function reportError($exception)
4141
}
4242
}
4343

44+
/**
45+
* Wrapper for 'newrelic_set_appname'
46+
*
47+
* @param string $appName
48+
* @return void
49+
*/
50+
public function setAppName(string $appName)
51+
{
52+
if (extension_loaded('newrelic')) {
53+
newrelic_set_appname($appName);
54+
}
55+
}
56+
4457
/**
4558
* Checks whether newrelic-php5 agent is installed
4659
*

0 commit comments

Comments
 (0)