Skip to content

Commit a38621a

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into develop
2 parents 51ce920 + daced02 commit a38621a

File tree

11 files changed

+226
-134
lines changed

11 files changed

+226
-134
lines changed

app/code/Magento/Catalog/Model/Product.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -836,12 +836,12 @@ public function eavReindexCallback()
836836
public function reindex()
837837
{
838838
if ($this->_catalogProduct->isDataForProductCategoryIndexerWasChanged($this) || $this->isDeleted()) {
839-
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
840-
$categoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
841-
if (!$categoryIndexer->isScheduled()) {
842-
$categoryIndexer->reindexRow($this->getId());
839+
$productCategoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
840+
if (!$productCategoryIndexer->isScheduled()) {
841+
$productCategoryIndexer->reindexRow($this->getId());
843842
}
844843
}
844+
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
845845
}
846846

847847
/**
@@ -2013,7 +2013,12 @@ public function getIdentities()
20132013
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
20142014
}
20152015
}
2016-
return $identities;
2016+
if ($this->getOrigData('status') > $this->getData('status')) {
2017+
foreach ($this->getData('category_ids') as $categoryId) {
2018+
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
2019+
}
2020+
}
2021+
return array_unique($identities);
20172022
}
20182023

20192024
/**

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<item name="entity_id" xsi:type="string">entity_id</item>
9090
<item name="store_id" xsi:type="string">store_id</item>
9191
<item name="visibility" xsi:type="string">visibility</item>
92+
<item name="status" xsi:type="string">status</item>
9293
</item>
9394
</argument>
9495
<argument name="productRepository" xsi:type="object">Magento\Catalog\Api\ProductRepositoryInterface\Proxy</argument>

dev/tests/integration/testsuite/Magento/ToolkitFramework/_files/small.xml

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,77 @@
77
-->
88
<config>
99
<profile>
10-
<websites>1</websites> <!-- Number of websites to generate -->
11-
<store_groups>1</store_groups> <!--Number of stores-->
12-
<store_views>1</store_views> <!-- Number of store views -->
13-
<simple_products>30</simple_products> <!-- Simple products count -->
14-
<configurable_products>10</configurable_products> <!--Configurable products count (each configurable has 3 simple products as options, that are not displayed individually in catalog) -->
15-
<categories>5</categories> <!-- Number of categories to generate -->
16-
<categories_nesting_level>3</categories_nesting_level> <!-- Nesting level for categories -->
17-
<catalog_price_rules>1</catalog_price_rules> <!-- Number os catalog price rules -->
18-
<cart_price_rules>1</cart_price_rules> <!-- Number of shopping cart price rules -->
19-
<cart_price_rules_floor>1</cart_price_rules_floor> <!-- The price rule condition: minimum products amount in shopping cart for price rule to be applied -->
20-
<customers>5</customers> <!-- Number of customers to generate -->
10+
<websites>1</websites>
11+
<!-- Number of websites to generate -->
12+
<store_groups>1</store_groups>
13+
<!--Number of stores-->
14+
<store_views>1</store_views>
15+
<!-- Number of store views -->
16+
<simple_products>800</simple_products>
17+
<!-- Simple products count -->
18+
<configurable_products>50</configurable_products>
19+
<!--Configurable products count (each configurable has 3 simple products as options, that are not displayed individually in catalog) -->
20+
<categories>30</categories>
21+
<!-- Number of categories to generate -->
22+
<categories_nesting_level>3</categories_nesting_level>
23+
<!-- Nesting level for categories -->
24+
<catalog_price_rules>10</catalog_price_rules>
25+
<!-- Number os catalog price rules -->
26+
<cart_price_rules>10</cart_price_rules>
27+
<!-- Number of shopping cart price rules -->
28+
<cart_price_rules_floor>2</cart_price_rules_floor>
29+
<!-- The price rule condition: minimum products amount in shopping cart for price rule to be applied -->
30+
<customers>20</customers>
31+
<!-- Number of customers to generate -->
32+
<configs> <!-- Config variables and values for change -->
33+
<config>
34+
<path>admin/security/use_form_key</path>
35+
<scope>default</scope>
36+
<scopeId>0</scopeId>
37+
<value>0</value>
38+
</config>
39+
<config>
40+
<path>carriers/flatrate/active</path>
41+
<scope>default</scope>
42+
<scopeId>0</scopeId>
43+
<value>1</value>
44+
</config>
45+
<config>
46+
<path>system/full_page_cache/ttl</path>
47+
<scope>default</scope>
48+
<scopeId>0</scopeId>
49+
<value>7200</value>
50+
</config>
51+
<config>
52+
<path>system/full_page_cache/caching_application</path>
53+
<scope>default</scope>
54+
<scopeId>0</scopeId>
55+
<value>2</value>
56+
</config>
57+
<config>
58+
<path>checkout/cart/redirect_to_cart</path>
59+
<scope>default</scope>
60+
<scopeId>0</scopeId>
61+
<value>0</value>
62+
</config>
63+
<config>
64+
<path>system/full_page_cache/varnish/access_lis</path>
65+
<scope>default</scope>
66+
<scopeId>0</scopeId>
67+
<value>localhost</value>
68+
</config>
69+
<config>
70+
<path>system/full_page_cache/varnish/backend_host</path>
71+
<scope>default</scope>
72+
<scopeId>0</scopeId>
73+
<value>localhost</value>
74+
</config>
75+
<config>
76+
<path>system/full_page_cache/varnish/backend_port</path>
77+
<scope>default</scope>
78+
<scopeId>0</scopeId>
79+
<value>8080</value>
80+
</config>
81+
</configs>
2182
</profile>
22-
</config>
83+
</config>

dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,20 @@ public function testIndexerAfterDeleteCommitProduct()
383383
public function testReindex($productChanged, $isScheduled, $productFlatCount, $categoryIndexerCount)
384384
{
385385
$this->model->setData('entity_id', 1);
386-
$this->_catalogProduct->expects($this->once())->method('isDataForProductCategoryIndexerWasChanged')->willReturn($productChanged);
386+
$this->_catalogProduct->expects($this->once())
387+
->method('isDataForProductCategoryIndexerWasChanged')
388+
->willReturn($productChanged);
389+
if ($productChanged) {
390+
$this->indexerRegistryMock->expects($this->exactly($productFlatCount))
391+
->method('get')
392+
->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
393+
->will($this->returnValue($this->categoryIndexerMock));
394+
$this->categoryIndexerMock->expects($this->any())
395+
->method('isScheduled')
396+
->will($this->returnValue($isScheduled));
397+
$this->categoryIndexerMock->expects($this->exactly($categoryIndexerCount))->method('reindexRow');
398+
}
387399
$this->productFlatProcessor->expects($this->exactly($productFlatCount))->method('reindexRow');
388-
$this->indexerRegistryMock->expects($this->exactly($productFlatCount))
389-
->method('get')
390-
->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
391-
->will($this->returnValue($this->categoryIndexerMock));
392-
$this->categoryIndexerMock->expects($this->any())->method('isScheduled')->will($this->returnValue($isScheduled));
393-
$this->categoryIndexerMock->expects($this->exactly($categoryIndexerCount))->method('reindexRow');
394-
395400
$this->model->reindex();
396401
}
397402

@@ -400,7 +405,7 @@ public function getProductReindexProvider()
400405
return array(
401406
'set 1' => [true, false, 1, 1],
402407
'set 2' => [true, true, 1, 0],
403-
'set 3' => [false, false, 0, 0]
408+
'set 3' => [false, false, 1, 0]
404409
);
405410
}
406411

@@ -465,6 +470,21 @@ public function getIdentitiesProvider()
465470
'affected_category_ids' => [1],
466471
'is_changed_categories' => true
467472
]
473+
],
474+
[
475+
[0 => 'catalog_product_1', 1 => 'catalog_category_product_1'],
476+
['id' => 1, 'name' => 'value', 'category_ids' => [1], 'status' => 2],
477+
['id' => 1, 'name' => 'value', 'category_ids' => [1], 'status' => 1],
478+
],
479+
[
480+
[0 => 'catalog_product_1'],
481+
['id' => 1, 'name' => 'value', 'category_ids' => [1], 'status' => 1],
482+
['id' => 1, 'name' => 'value', 'category_ids' => [1], 'status' => 2],
483+
],
484+
[
485+
[0 => 'catalog_product_1'],
486+
['id' => 1, 'name' => 'value', 'category_ids' => [1], 'status' => 2],
487+
['id' => 1, 'name' => 'value', 'category_ids' => [], 'status' => 1],
468488
]
469489
];
470490
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Class ConfigsApplyFixture
9+
*/
10+
class ConfigsApplyFixture extends \Magento\ToolkitFramework\Fixture
11+
{
12+
/**
13+
* @var int
14+
*/
15+
protected $priority = 150;
16+
17+
/**
18+
* {@inheritdoc}
19+
*/
20+
public function execute()
21+
{
22+
$configs = \Magento\ToolkitFramework\Config::getInstance()->getValue('configs', array());
23+
$this->application->resetObjectManager();
24+
25+
foreach ($configs['config'] as $config) {
26+
/**
27+
* @var \Magento\Framework\App\Config\Value $configData
28+
*/
29+
$configData = $this->application->getObjectManager()->create('Magento\Framework\App\Config\Value');
30+
$configData->setPath($config['path'])
31+
->setScope($config['scope'])
32+
->setScopeId($config['scopeId'])
33+
->setValue($config['value'])
34+
->save();
35+
}
36+
$this->application->getObjectManager()->get('Magento\Framework\App\CacheInterface')
37+
->clean([\Magento\Framework\App\Config::CACHE_TAG]);
38+
}
39+
40+
/**
41+
* {@inheritdoc}
42+
*/
43+
public function getActionTitle()
44+
{
45+
return 'Config Changes';
46+
}
47+
48+
/**
49+
* {@inheritdoc}
50+
*/
51+
public function introduceParamLabels()
52+
{
53+
return [];
54+
}
55+
}
56+
57+
return new ConfigsApplyFixture($this);

dev/tools/performance-toolkit/fixtures/disable_form_key_usage.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

dev/tools/performance-toolkit/fixtures/shipping_flatrate_enabled.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

dev/tools/performance-toolkit/profiles/ce/extra_large.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,19 @@
1818
<cart_price_rules>100</cart_price_rules> <!-- Number of shopping cart price rules -->
1919
<cart_price_rules_floor>5</cart_price_rules_floor> <!-- The price rule condition: minimum products amount in shopping cart for price rule to be applied -->
2020
<customers>5000</customers> <!-- Number of customers to generate -->
21+
<configs> <!-- Config variables and values for change -->
22+
<config>
23+
<path>admin/security/use_form_key</path>
24+
<scope>default</scope>
25+
<scopeId>0</scopeId>
26+
<value>0</value>
27+
</config>
28+
<config>
29+
<path>carriers/flatrate/active</path>
30+
<scope>default</scope>
31+
<scopeId>0</scopeId>
32+
<value>1</value>
33+
</config>
34+
</configs>
2135
</profile>
2236
</config>

dev/tools/performance-toolkit/profiles/ce/large.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,19 @@
1818
<cart_price_rules>50</cart_price_rules> <!-- Number of shopping cart price rules -->
1919
<cart_price_rules_floor>2</cart_price_rules_floor> <!-- The price rule condition: minimum products amount in shopping cart for price rule to be applied -->
2020
<customers>2000</customers> <!-- Number of customers to generate -->
21+
<configs> <!-- Config variables and values for change -->
22+
<config>
23+
<path>admin/security/use_form_key</path>
24+
<scope>default</scope>
25+
<scopeId>0</scopeId>
26+
<value>0</value>
27+
</config>
28+
<config>
29+
<path>carriers/flatrate/active</path>
30+
<scope>default</scope>
31+
<scopeId>0</scopeId>
32+
<value>1</value>
33+
</config>
34+
</configs>
2135
</profile>
2236
</config>

0 commit comments

Comments
 (0)