Skip to content

Commit f76cb3b

Browse files
author
Bohdan Korablov
committed
MAGETWO-45357: Nonexistent Area is Set in Setup Application
2 parents 64d65a4 + 5c6b2d6 commit f76cb3b

File tree

17 files changed

+846
-109
lines changed

17 files changed

+846
-109
lines changed

.htaccess

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
DirectoryIndex index.php
3434

35+
<IfModule mod_php5.c>
3536
############################################
3637
## adjust memory limit
3738

@@ -53,7 +54,30 @@
5354
## disable user agent verification to not break multiple image upload
5455

5556
php_flag suhosin.session.cryptua off
57+
</IfModule>
58+
<IfModule mod_php7.c>
59+
############################################
60+
## adjust memory limit
61+
62+
php_value memory_limit 768M
63+
php_value max_execution_time 18000
64+
65+
############################################
66+
## disable automatic session start
67+
## before autoload was initialized
68+
69+
php_flag session.auto_start off
70+
71+
############################################
72+
## enable resulting html compression
73+
74+
#php_flag zlib.output_compression on
5675

76+
###########################################
77+
## disable user agent verification to not break multiple image upload
78+
79+
php_flag suhosin.session.cryptua off
80+
</IfModule>
5781
<IfModule mod_security.c>
5882
###########################################
5983
## disable POST processing to not break multiple image upload

.user.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
memory_limit = 768M
2+
max_execution_time = 18000
3+
session.auto_start = off
4+
suhosin.session.cryptua = off

app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ public function reindexByIds(array $ids)
159159
$this->doReindexByIds($ids);
160160
} catch (\Exception $e) {
161161
$this->critical($e);
162-
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
162+
throw new \Magento\Framework\Exception\LocalizedException(
163+
__("Catalog rule indexing failed. See details in exception log.")
164+
);
163165
}
164166
}
165167

@@ -193,7 +195,9 @@ public function reindexFull()
193195
$this->doReindexFull();
194196
} catch (\Exception $e) {
195197
$this->critical($e);
196-
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
198+
throw new \Magento\Framework\Exception\LocalizedException(
199+
__("Catalog rule indexing failed. See details in exception log.")
200+
);
197201
}
198202
}
199203

app/code/Magento/Rule/Model/ResourceModel/Rule/Collection/AbstractCollection.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,18 @@ public function addWebsitesToResult($flag = null)
7474
*/
7575
public function addWebsiteFilter($websiteId)
7676
{
77-
$entityInfo = $this->_getAssociatedEntityInfo('website');
7877
if (!$this->getFlag('is_website_table_joined')) {
78+
$websiteIds = is_array($websiteId) ? $websiteId : [$websiteId];
79+
$entityInfo = $this->_getAssociatedEntityInfo('website');
7980
$this->setFlag('is_website_table_joined', true);
80-
if ($websiteId instanceof \Magento\Store\Model\Website) {
81-
$websiteId = $websiteId->getId();
81+
foreach ($websiteIds as $index => $website) {
82+
if ($website instanceof \Magento\Store\Model\Website) {
83+
$websiteIds[$index] = $website->getId();
84+
}
8285
}
8386
$this->getSelect()->join(
8487
['website' => $this->getTable($entityInfo['associations_table'])],
85-
$this->getConnection()->quoteInto('website.' . $entityInfo['entity_id_field'] . ' = ?', $websiteId)
88+
$this->getConnection()->quoteInto('website.' . $entityInfo['entity_id_field'] . ' IN (?)', $websiteIds)
8689
. ' AND main_table.' . $entityInfo['rule_id_field'] . ' = website.' . $entityInfo['rule_id_field'],
8790
[]
8891
);

app/code/Magento/Rule/Test/Unit/Model/ResourceModel/Rule/Collection/AbstractCollectionTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase
4545
*/
4646
protected $_db;
4747

48+
/**
49+
* @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
50+
*/
51+
private $connectionMock;
52+
53+
/**
54+
* @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject
55+
*/
56+
private $selectMock;
57+
4858
protected function setUp()
4959
{
5060
$this->_entityFactoryMock = $this->getMock(\Magento\Framework\Data\Collection\EntityFactoryInterface::class);
@@ -152,6 +162,30 @@ public function testAddWebsiteFilter()
152162
);
153163
}
154164

165+
public function testAddWebsiteFilterArray()
166+
{
167+
$this->selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
168+
->disableOriginalConstructor()
169+
->getMock();
170+
171+
$this->connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
172+
->disableOriginalConstructor()
173+
->getMockForAbstractClass();
174+
$this->connectionMock->expects($this->atLeastOnce())
175+
->method('quoteInto')
176+
->with($this->equalTo('website. IN (?)'), $this->equalTo(['2', '3']))
177+
->willReturn(true);
178+
179+
$this->abstractCollection->expects($this->atLeastOnce())->method('getSelect')->willReturn($this->selectMock);
180+
$this->abstractCollection->expects($this->atLeastOnce())->method('getConnection')
181+
->willReturn($this->connectionMock);
182+
183+
$this->assertInstanceOf(
184+
\Magento\Rule\Model\ResourceModel\Rule\Collection\AbstractCollection::class,
185+
$this->abstractCollection->addWebsiteFilter(['2', '3'])
186+
);
187+
}
188+
155189
public function testAddFieldToFilter()
156190
{
157191
$this->_prepareAddFilterStubs();

app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<argument name="dataSource" xsi:type="object">Magento\Sales\Model\ResourceModel\Status\Collection</argument>
1616
<argument name="default_sort" xsi:type="string">state</argument>
1717
<argument name="default_dir" xsi:type="string">desc</argument>
18-
<argument name="pager_visibility" xsi:type="string">0</argument>
18+
<argument name="pager_visibility" xsi:type="string">1</argument>
1919
</arguments>
2020
<block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="sales_order_status.grid.columnSet">
2121
<arguments>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Util\Command\Cli;
8+
9+
/**
10+
* Class Queue
11+
*/
12+
class Queue extends \Magento\Mtf\Util\Command\Cli
13+
{
14+
/**
15+
* Starts consumer
16+
*
17+
* @param string $consumer
18+
*/
19+
public function run($consumer)
20+
{
21+
parent::execute('queue:consumers:start ' . $consumer . ' > /dev/null &');
22+
}
23+
}

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Magento\Framework\Phrase;
2727
use Magento\Framework\Stdlib\DateTime;
2828
use Magento\Framework\Stdlib\StringUtils;
29+
use Magento\Framework\DB\Query\Generator as QueryGenerator;
2930

3031
/**
3132
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
@@ -199,6 +200,11 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
199200
*/
200201
private $exceptionMap;
201202

203+
/**
204+
* @var QueryGenerator
205+
*/
206+
private $queryGenerator;
207+
202208
/**
203209
* @param StringUtils $string
204210
* @param DateTime $dateTime
@@ -3362,57 +3368,32 @@ public function insertFromSelect(Select $select, $table, array $fields = [], $mo
33623368
* @param int $stepCount
33633369
* @return \Magento\Framework\DB\Select[]
33643370
* @throws LocalizedException
3371+
* @deprecated
33653372
*/
33663373
public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100)
33673374
{
3368-
$fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM);
3369-
if (empty($fromSelect)) {
3370-
throw new LocalizedException(
3371-
new \Magento\Framework\Phrase('Select object must have correct "FROM" part')
3372-
);
3373-
}
3374-
3375-
$tableName = [];
3376-
$correlationName = '';
3377-
foreach ($fromSelect as $correlationName => $formPart) {
3378-
if ($formPart['joinType'] == \Magento\Framework\DB\Select::FROM) {
3379-
$tableName = $formPart['tableName'];
3380-
break;
3381-
}
3382-
}
3383-
3384-
$selectRange = $this->select()
3385-
->from(
3386-
$tableName,
3387-
[
3388-
new \Zend_Db_Expr('MIN(' . $this->quoteIdentifier($rangeField) . ') AS min'),
3389-
new \Zend_Db_Expr('MAX(' . $this->quoteIdentifier($rangeField) . ') AS max'),
3390-
]
3391-
);
3392-
3393-
$rangeResult = $this->fetchRow($selectRange);
3394-
$min = $rangeResult['min'];
3395-
$max = $rangeResult['max'];
3396-
3375+
$iterator = $this->getQueryGenerator()->generate($rangeField, $select, $stepCount);
33973376
$queries = [];
3398-
while ($min <= $max) {
3399-
$partialSelect = clone $select;
3400-
$partialSelect->where(
3401-
$this->quoteIdentifier($correlationName) . '.'
3402-
. $this->quoteIdentifier($rangeField) . ' >= ?',
3403-
$min
3404-
)
3405-
->where(
3406-
$this->quoteIdentifier($correlationName) . '.'
3407-
. $this->quoteIdentifier($rangeField) . ' < ?',
3408-
$min + $stepCount
3409-
);
3410-
$queries[] = $partialSelect;
3411-
$min += $stepCount;
3377+
foreach ($iterator as $query) {
3378+
$queries[] = $query;
34123379
}
34133380
return $queries;
34143381
}
34153382

3383+
/**
3384+
* Get query generator
3385+
*
3386+
* @return QueryGenerator
3387+
* @deprecated
3388+
*/
3389+
private function getQueryGenerator()
3390+
{
3391+
if ($this->queryGenerator === null) {
3392+
$this->queryGenerator = \Magento\Framework\App\ObjectManager::getInstance()->create(QueryGenerator::class);
3393+
}
3394+
return $this->queryGenerator;
3395+
}
3396+
34163397
/**
34173398
* Get update table query using select object for join and update
34183399
*

0 commit comments

Comments
 (0)