Skip to content

Commit ca56c0a

Browse files
committed
Merge remote-tracking branch 'mainline/2.2-develop' into MAGETWO-64085
2 parents 9de3b46 + fd81f51 commit ca56c0a

File tree

247 files changed

+9297
-2082
lines changed

Some content is hidden

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

247 files changed

+9297
-2082
lines changed

app/code/Magento/Backend/Block/Template.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,22 @@ public function getFormKey()
8585
*
8686
* @param string $moduleName Full module name
8787
* @return boolean
88-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
89-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
88+
* @deprecated 100.2.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
89+
* version. Module output can still be enabled/disabled in configuration files. However, this functionality should
90+
* not be used in future development. Module design should explicitly state dependencies to avoid requiring output
91+
* disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
92+
* issues that will be addressed in future releases.
9093
*/
9194
public function isOutputEnabled($moduleName = null)
9295
{
93-
return true;
96+
if ($moduleName === null) {
97+
$moduleName = $this->getModuleName();
98+
}
99+
100+
return !$this->_scopeConfig->isSetFlag(
101+
'advanced/modules_disable_output/' . $moduleName,
102+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
103+
);
94104
}
95105

96106
/**

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@
160160
<argument name="estimators" xsi:type="array">
161161
<item name="bundle" xsi:type="object">Magento\Catalog\Model\Indexer\Price\CompositeProductBatchSizeManagement</item>
162162
</argument>
163+
<argument name="batchSizeAdjusters" xsi:type="array">
164+
<item name="bundle" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\CompositeProductBatchSizeAdjuster</item>
165+
</argument>
163166
</arguments>
164167
</type>
165168
<type name="Magento\Bundle\Model\ResourceModel\Indexer\Price">

app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5-
/*jshint browser:true jquery:true expr:true*/
5+
66
define([
77
'jquery',
88
'Magento_Catalog/catalog/type-events',

app/code/Magento/Bundle/view/frontend/web/js/float.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/**
77
* @api
8+
* @deprecated since version 2.2.0
89
*/
910
define([
1011
'jquery',

app/code/Magento/Captcha/view/frontend/web/onepage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/**
7+
* @deprecated since version 2.2.0
8+
*/
69
define(['jquery'], function ($) {
710
'use strict';
811

app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public function execute($ids = null)
106106
$this->_defaultIndexerResource->getMainTable()
107107
);
108108

109+
// Prepare replica table for indexation.
110+
$this->_defaultIndexerResource->getConnection()->truncateTable($replicaTable);
111+
109112
/** @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\AbstractIndexer $indexer */
110113
foreach ($this->getTypeIndexers() as $indexer) {
111114
$indexer->getTableStrategy()->setUseIdxTable(false);

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/BatchSizeCalculator.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,24 @@ class BatchSizeCalculator
2121
*/
2222
private $estimators;
2323

24+
/**
25+
* @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\CompositeProductBatchSizeAdjusterInterface[]
26+
* @since 2.2.0
27+
*/
28+
private $batchSizeAdjusters;
29+
2430
/**
2531
* BatchSizeCalculator constructor.
2632
* @param array $batchRowsCount
2733
* @param array $estimators
34+
* @param array $batchSizeAdjusters
35+
* @since 2.2.0
2836
*/
29-
public function __construct(array $batchRowsCount, array $estimators)
37+
public function __construct(array $batchRowsCount, array $estimators, array $batchSizeAdjusters)
3038
{
3139
$this->batchRowsCount = $batchRowsCount;
3240
$this->estimators = $estimators;
41+
$this->batchSizeAdjusters = $batchSizeAdjusters;
3342
}
3443

3544
/**
@@ -52,6 +61,10 @@ public function estimateBatchSize(\Magento\Framework\DB\Adapter\AdapterInterface
5261
? $this->estimators[$indexerTypeId]
5362
: $this->estimators['default'];
5463

64+
$batchRowsCount = isset($this->batchSizeAdjusters[$indexerTypeId])
65+
? $this->batchSizeAdjusters[$indexerTypeId]->adjust($batchRowsCount)
66+
: $batchRowsCount;
67+
5568
$calculator->ensureBatchSize($connection, $batchRowsCount);
5669

5770
return $batchRowsCount;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Model\ResourceModel\Product\Indexer\Price;
8+
9+
/**
10+
* Correct batch size according to number of composite related items.
11+
*/
12+
class CompositeProductBatchSizeAdjuster implements CompositeProductBatchSizeAdjusterInterface
13+
{
14+
/**
15+
* @var CompositeProductRelationsCalculator
16+
*/
17+
private $compositeProductRelationsCalculator;
18+
19+
/**
20+
* @param CompositeProductRelationsCalculator $compositeProductRelationsCalculator
21+
*/
22+
public function __construct(CompositeProductRelationsCalculator $compositeProductRelationsCalculator)
23+
{
24+
$this->compositeProductRelationsCalculator = $compositeProductRelationsCalculator;
25+
}
26+
27+
/**
28+
* {@inheritdoc}
29+
*/
30+
public function adjust($batchSize)
31+
{
32+
$maxRelationsCount = $this->compositeProductRelationsCalculator->getMaxRelationsCount();
33+
return $maxRelationsCount > 0 ? ceil($batchSize / $maxRelationsCount) : $batchSize;
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Model\ResourceModel\Product\Indexer\Price;
8+
9+
/**
10+
* Correct batch size according to number of composite related items.
11+
* @api
12+
*/
13+
interface CompositeProductBatchSizeAdjusterInterface
14+
{
15+
/**
16+
* Correct batch size according to number of composite related items.
17+
*
18+
* @param int $batchSize
19+
* @return int
20+
*/
21+
public function adjust($batchSize);
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Model\ResourceModel\Product\Indexer\Price;
8+
9+
/**
10+
* Class calculates composite product relations.
11+
*/
12+
class CompositeProductRelationsCalculator
13+
{
14+
/**
15+
* @param DefaultPrice $indexerResource
16+
*/
17+
public function __construct(DefaultPrice $indexerResource)
18+
{
19+
$this->indexerResource = $indexerResource;
20+
}
21+
22+
/**
23+
* Returns maximum number of composite related products.
24+
*
25+
* @return int
26+
*/
27+
public function getMaxRelationsCount()
28+
{
29+
$connection = $this->indexerResource->getConnection();
30+
$relationSelect = $connection->select();
31+
$relationSelect->from(
32+
['relation' => $this->indexerResource->getTable('catalog_product_relation')],
33+
['count' => new \Zend_Db_Expr('count(relation.child_id)')]
34+
);
35+
$relationSelect->group('parent_id');
36+
37+
$maxSelect = $connection->select();
38+
$maxSelect->from(
39+
['max_value' => $relationSelect],
40+
['count' => new \Zend_Db_Expr('MAX(count)')]
41+
);
42+
return $connection->fetchOne($maxSelect);
43+
}
44+
}

0 commit comments

Comments
 (0)