Skip to content

Commit 12b3c90

Browse files
author
Mykhailo Miroshnikov
committed
Merge branch 'develop' of https://github.corp.ebay.com/magento-vanilla/magento2ce into MAGETWO-33522
2 parents d33010b + 2aa22d6 commit 12b3c90

File tree

75 files changed

+9603
-3180
lines changed

Some content is hidden

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

75 files changed

+9603
-3180
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@
211211
<label>Merge CSS Files</label>
212212
<source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
213213
</field>
214+
<field id="minify_files" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
215+
<label>Minify CSS Files</label>
216+
<source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
217+
</field>
214218
</group>
215219
<group id="image" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="0" showInStore="0">
216220
<label>Image Processing Settings</label>

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ class Product extends \Magento\Core\Helper\Url
8181
*/
8282
protected $_catalogSession;
8383

84+
/**
85+
* Invalidate product category indexer params
86+
*
87+
* @var array
88+
*/
89+
protected $_reindexProductCategoryIndexerData;
90+
8491
/**
8592
* Invalidate price indexer params
8693
*
@@ -109,6 +116,7 @@ class Product extends \Magento\Core\Helper\Url
109116
* @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig
110117
* @param string $typeSwitcherLabel
111118
* @param array $reindexPriceIndexerData
119+
* @param array $reindexProductCategoryIndexerData
112120
* @param ProductRepositoryInterface $productRepository
113121
* @param CategoryRepositoryInterface $categoryRepository
114122
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -124,6 +132,7 @@ public function __construct(
124132
\Magento\Framework\App\Config\ScopeConfigInterface $coreConfig,
125133
$typeSwitcherLabel,
126134
$reindexPriceIndexerData,
135+
$reindexProductCategoryIndexerData,
127136
ProductRepositoryInterface $productRepository,
128137
CategoryRepositoryInterface $categoryRepository
129138
) {
@@ -137,6 +146,7 @@ public function __construct(
137146
$this->_reindexPriceIndexerData = $reindexPriceIndexerData;
138147
$this->productRepository = $productRepository;
139148
$this->categoryRepository = $categoryRepository;
149+
$this->_reindexProductCategoryIndexerData = $reindexProductCategoryIndexerData;
140150
parent::__construct($context, $storeManager);
141151
}
142152

@@ -169,6 +179,22 @@ public function isDataForPriceIndexerWasChanged($data)
169179
return false;
170180
}
171181

182+
/**
183+
* Retrieve data for product category indexer update
184+
*
185+
* @param \Magento\Catalog\Model\Product $data
186+
* @return boolean
187+
*/
188+
public function isDataForProductCategoryIndexerWasChanged(\Magento\Catalog\Model\Product $data)
189+
{
190+
foreach ($this->_reindexProductCategoryIndexerData['byDataChange'] as $param) {
191+
if ($data->dataHasChangedFor($param)) {
192+
return true;
193+
}
194+
}
195+
return false;
196+
}
197+
172198
/**
173199
* Retrieve product view page url
174200
*

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,9 @@ public function reindex()
10241024
$flatIndexer->reindexRow($this->getId());
10251025
}
10261026
}
1027+
$affectedProductIds = $this->getAffectedProductIds();
10271028
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
1028-
if (!$productIndexer->isScheduled()) {
1029+
if (!$productIndexer->isScheduled() && !empty($affectedProductIds)) {
10291030
$productIndexer->reindexList($this->getPathIds());
10301031
}
10311032
}

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,12 @@ public function eavReindexCallback()
835835
*/
836836
public function reindex()
837837
{
838-
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
839-
$categoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
840-
if (!$categoryIndexer->isScheduled()) {
841-
$categoryIndexer->reindexRow($this->getId());
838+
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());
843+
}
842844
}
843845
}
844846

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
</argument>
6161
</arguments>
6262
</type>
63-
<type name="Magento\Catalog\Model\Indexer\Category\Product\AbstractAction">
64-
<plugin name="invalidate_pagecache_after_rows_reindex" type="Magento\Catalog\Plugin\Model\Indexer\Category\Product\Execute" />
63+
<type name="Magento\Catalog\Model\Indexer\Category\Product\Action\Full">
64+
<plugin name="invalidate_pagecache_after_full_reindex" type="Magento\Catalog\Plugin\Model\Indexer\Category\Product\Execute" />
6565
</type>
6666
<type name="Magento\Catalog\Model\Resource\Attribute">
67-
<plugin name="invalidate_cache_after_rows_reindex" type="Magento\Catalog\Plugin\Model\Resource\Attribute\Save" />
67+
<plugin name="invalidate_pagecache_after_attribute_save" type="Magento\Catalog\Plugin\Model\Resource\Attribute\Save" />
6868
</type>
6969
</config>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@
8383
<item name="tax_class_id" xsi:type="string">tax_class_id</item>
8484
</item>
8585
</argument>
86+
<argument name="reindexProductCategoryIndexerData" xsi:type="array">
87+
<item name="byDataChange" xsi:type="array">
88+
<item name="category_ids" xsi:type="string">category_ids</item>
89+
<item name="entity_id" xsi:type="string">entity_id</item>
90+
<item name="store_id" xsi:type="string">store_id</item>
91+
<item name="visibility" xsi:type="string">visibility</item>
92+
</item>
93+
</argument>
8694
<argument name="productRepository" xsi:type="object">Magento\Catalog\Api\ProductRepositoryInterface\Proxy</argument>
8795
</arguments>
8896
</type>

app/code/Magento/Core/etc/config.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<minify_files>0</minify_files>
2626
<minify_adapter>Magento\Framework\Code\Minifier\Adapter\Js\Jsmin</minify_adapter>
2727
</js>
28+
<css>
29+
<minify_files>0</minify_files>
30+
<minify_adapter>Magento\Framework\Code\Minifier\Adapter\Css\CssMinifier</minify_adapter>
31+
</css>
2832
<image>
2933
<default_adapter>GD2</default_adapter>
3034
<adapters>
@@ -98,6 +102,7 @@
98102
</startup>
99103
<url>
100104
<use_custom>0</use_custom>
105+
<use_custom_path>0</use_custom_path>
101106
<custom />
102107
</url>
103108
<security>

app/code/Magento/PageCache/Block/System/Config/Form/Field/Export.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,39 @@ class Export extends \Magento\Backend\Block\System\Config\Form\Field
1515
*
1616
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
1717
* @return string
18+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
1819
*/
1920
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
2021
{
2122
/** @var \Magento\Backend\Block\Widget\Button $buttonBlock */
2223
$buttonBlock = $this->getForm()->getLayout()->createBlock('Magento\Backend\Block\Widget\Button');
2324

24-
$params = ['website' => $buttonBlock->getRequest()->getParam('website')];
25+
$params = [
26+
'website' => $buttonBlock->getRequest()->getParam('website'),
27+
'varnish' => $this->getVarnishVersion()
28+
];
2529

2630
$url = $this->getUrl("*/PageCache/exportVarnishConfig", $params);
2731
$data = [
28-
'id' => 'system_full_page_cache_varnish_export_button',
29-
'label' => __('Export VCL'),
32+
'id' => 'system_full_page_cache_varnish_export_button_version' . $this->getVarnishVersion(),
33+
'label' => __('Export VCL for Varnish ') . $this->getVarnishVersion(),
3034
'onclick' => "setLocation('" . $url . "')",
3135
];
3236

3337
$html = $buttonBlock->setData($data)->toHtml();
3438
return $html;
3539
}
3640

41+
/**
42+
* Return Varnish version to this class
43+
*
44+
* @return int
45+
*/
46+
public function getVarnishVersion()
47+
{
48+
return 0;
49+
}
50+
3751
/**
3852
* Return PageCache TTL value from config
3953
* to avoid saving empty field
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\PageCache\Block\System\Config\Form\Field\Export;
7+
8+
/**
9+
* Class Export
10+
*/
11+
class Varnish3 extends \Magento\PageCache\Block\System\Config\Form\Field\Export
12+
{
13+
/**
14+
* Return Varnish version to this class
15+
*
16+
* @return int
17+
*/
18+
public function getVarnishVersion()
19+
{
20+
return 3;
21+
}
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\PageCache\Block\System\Config\Form\Field\Export;
7+
8+
/**
9+
* Class Export
10+
*/
11+
class Varnish4 extends \Magento\PageCache\Block\System\Config\Form\Field\Export
12+
{
13+
/**
14+
* Return Varnish version to this class
15+
*
16+
* @return int
17+
*/
18+
public function getVarnishVersion()
19+
{
20+
return 4;
21+
}
22+
}

0 commit comments

Comments
 (0)