Skip to content

Commit ae6bbb4

Browse files
author
Magento CICD
authored
merge magento/2.2-develop into magento-helix/MAGETWO-75544
2 parents b3da865 + 0cec6c5 commit ae6bbb4

File tree

6 files changed

+77
-14
lines changed

6 files changed

+77
-14
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,11 @@ public function reindex()
10941094
if ($this->flatState->isFlatEnabled()) {
10951095
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
10961096
if (!$flatIndexer->isScheduled()) {
1097-
$flatIndexer->reindexRow($this->getId());
1097+
$idsList = [$this->getId()];
1098+
if ($this->dataHasChangedFor('url_key')) {
1099+
$idsList = array_merge($idsList, explode(',', $this->getAllChildren()));
1100+
}
1101+
$flatIndexer->reindexList($idsList);
10981102
}
10991103
}
11001104
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);

app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
318318
->will($this->returnValue(true));
319319

320320
$this->flatIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($flatScheduled));
321-
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexRow')->with('123');
321+
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexList')->with(['123']);
322322

323323
$this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled));
324324
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Swagger\Block;
7+
8+
use Magento\Framework\View\Element\Template;
9+
10+
/**
11+
* Class Index
12+
*
13+
* @api
14+
*/
15+
class Index extends Template
16+
{
17+
/**
18+
* @return mixed|string
19+
*/
20+
private function getParamStore()
21+
{
22+
return ($this->getRequest()->getParam('store')) ? $this->getRequest()->getParam('store') : 'all';
23+
}
24+
25+
/**
26+
* @return string
27+
*/
28+
public function getSchemaUrl()
29+
{
30+
return rtrim($this->getBaseUrl(), '/') . '/rest/' . $this->getParamStore() . '/schema?services=all';
31+
}
32+
}

app/code/Magento/Swagger/view/frontend/layout/swagger_index_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<referenceContainer name="page.wrapper" remove="true"/>
4646
<referenceBlock name="requirejs-config" remove="true"/>
4747
<referenceContainer name="root">
48-
<block name="swaggerUiContent" class="Magento\Framework\View\Element\Template" template="Magento_Swagger::swagger-ui/index.phtml"/>
48+
<block name="swaggerUiContent" class="Magento\Swagger\Block\Index" template="Magento_Swagger::swagger-ui/index.phtml"/>
4949
</referenceContainer>
5050
</body>
5151
</page>

app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
/** @var \Magento\Framework\View\Element\Template $block */
1616

17-
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/all/schema?services=all';
17+
$schemaUrl = $block->getSchemaUrl();
1818
?>
1919

2020
<div id='header'>

app/code/Magento/Theme/Model/Design/Config/Validator.php

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,8 @@ public function validate(DesignConfigInterface $designConfig)
6464
}
6565

6666
foreach ($elements as $name => $data) {
67-
// Load template object by configured template id
68-
$template = $this->templateFactory->create();
69-
$template->emulateDesign($designConfig->getScopeId());
7067
$templateId = $data['value'];
71-
if (is_numeric($templateId)) {
72-
$template->load($templateId);
73-
} else {
74-
$template->loadDefault($templateId);
75-
}
76-
$text = $template->getTemplateText();
77-
$template->revertDesign();
68+
$text = $this->getTemplateText($templateId, $designConfig);
7869
// Check if template body has a reference to the same config path
7970
if (preg_match_all(Template::CONSTRUCTION_TEMPLATE_PATTERN, $text, $constructions, PREG_SET_ORDER)) {
8071
foreach ($constructions as $construction) {
@@ -94,6 +85,42 @@ public function validate(DesignConfigInterface $designConfig)
9485
}
9586
}
9687

88+
/**
89+
* Returns store identifier if is store scope
90+
*
91+
* @param DesignConfigInterface $designConfig
92+
* @return string|bool
93+
*/
94+
private function getScopeId(DesignConfigInterface $designConfig)
95+
{
96+
if ($designConfig->getScope() == 'stores') {
97+
return $designConfig->getScopeId();
98+
}
99+
return false;
100+
}
101+
102+
/**
103+
* Load template text in configured scope
104+
*
105+
* @param integer|string $templateId
106+
* @param DesignConfigInterface $designConfig
107+
* @return string
108+
*/
109+
private function getTemplateText($templateId, DesignConfigInterface $designConfig)
110+
{
111+
// Load template object by configured template id
112+
$template = $this->templateFactory->create();
113+
$template->emulateDesign($this->getScopeId($designConfig));
114+
if (is_numeric($templateId)) {
115+
$template->load($templateId);
116+
} else {
117+
$template->loadDefault($templateId);
118+
}
119+
$text = $template->getTemplateText();
120+
$template->revertDesign();
121+
return $text;
122+
}
123+
97124
/**
98125
* Return associative array of parameters.
99126
*

0 commit comments

Comments
 (0)