Skip to content

Commit ac401f5

Browse files
authored
Merge pull request #2214 from magento-gl/2.4-develop
Sync 2.4-develop to AC-14417
2 parents 9d3b3f7 + a04b0ef commit ac401f5

File tree

191 files changed

+1198
-1226
lines changed

Some content is hidden

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

191 files changed

+1198
-1226
lines changed

app/code/Magento/AsyncConfig/Test/Mftf/Test/AsyncConfigurationTest.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
@@ -59,8 +59,10 @@
5959
<see selector="{{CatalogSection.successMessage}}" userInput="Configuration changes will be applied by consumer soon." stepKey="seeCustomSuccessMessage"/>
6060

6161
<!--Trigger the Consumer-->
62-
<magentoCLI stepKey="EnableAsyncConfig" command="queue:consumers:start saveConfigProcessor --max-messages=1"/>
63-
62+
<actionGroup ref="CliConsumerStartActionGroup" stepKey="EnableAsyncConfig">
63+
<argument name="consumerName" value="saveConfigProcessor"/>
64+
<argument name="maxMessages" value="1"/>
65+
</actionGroup>
6466
<!--Open Configuration Page Again-->
6567
<amOnPage url="{{CatalogConfigPage.url}}" stepKey="navigateToConfigurationPageAgain" />
6668
<waitForPageLoad stepKey="waitForPageLoadAgain"/>

app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,10 @@ public function getFrontName($checkHost = false)
107107
if ($checkHost && !$this->isHostBackend()) {
108108
return false;
109109
}
110-
$isCustomPathUsed = (bool)(string)$this->config->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_PATH);
111-
if ($isCustomPathUsed) {
112-
return (string)$this->config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH);
113-
}
114-
return $this->defaultFrontName;
110+
111+
return $this->config->isSetFlag(self::XML_PATH_USE_CUSTOM_ADMIN_PATH)
112+
? (string)$this->config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH)
113+
: $this->defaultFrontName;
115114
}
116115

117116
/**
@@ -127,9 +126,8 @@ public function isHostBackend()
127126
if (!$this->request->getServer('HTTP_HOST')) {
128127
return false;
129128
}
130-
131-
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
132-
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
129+
if ($this->scopeConfig->isSetFlag(self::XML_PATH_USE_CUSTOM_ADMIN_URL)) {
130+
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL);
133131
} else {
134132
$xmlPath = $this->request->isSecure() ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL;
135133
$backendUrl = $this->config->getValue($xmlPath);
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/************************************************************************
4+
*
5+
* ADOBE CONFIDENTIAL
6+
* ___________________
7+
*
8+
* Copyright 2025 Adobe
9+
* All Rights Reserved.
10+
*
11+
* NOTICE: All information contained herein is, and remains
12+
* the property of Adobe and its suppliers, if any. The intellectual
13+
* and technical concepts contained herein are proprietary to Adobe
14+
* and its suppliers and are protected by all applicable intellectual
15+
* property laws, including trade secret and copyright laws.
16+
* Dissemination of this information or reproduction of this material
17+
* is strictly forbidden unless prior written permission is obtained
18+
* from Adobe.
19+
* ************************************************************************
20+
*/
721
-->
822

923
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1024
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1125
<entity name="backendDataOne" type="backend">
1226
<data key="backendConfigName">data</data>
1327
</entity>
28+
<entity name="WebdriverKey">
29+
<data key="tabKey">[\Facebook\WebDriver\WebDriverKeys::TAB]</data>
30+
</entity>
1431
</entities>

app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php

100644100755
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,16 @@ protected function setUp(): void
8080
*/
8181
public function testIfCustomPathUsed(): void
8282
{
83-
$this->configMock
83+
$this->configMock->expects($this->once())
84+
->method('isSetFlag')
85+
->with(FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_PATH)
86+
->willReturn(true);
87+
88+
$this->configMock->expects($this->once())
8489
->method('getValue')
85-
->willReturnCallback(fn($param) => match ([$param]) {
86-
['admin/url/use_custom_path'] => true,
87-
['admin/url/custom_path'] => 'expectedValue'
88-
});
90+
->with(FrontNameResolver::XML_PATH_CUSTOM_ADMIN_PATH)
91+
->willReturn('expectedValue');
92+
8993
$this->assertEquals('expectedValue', $this->model->getFrontName());
9094
}
9195

@@ -94,15 +98,11 @@ public function testIfCustomPathUsed(): void
9498
*/
9599
public function testIfCustomPathNotUsed(): void
96100
{
97-
$this->configMock->expects(
98-
$this->once()
99-
)->method(
100-
'getValue'
101-
)->with(
102-
'admin/url/use_custom_path'
103-
)->willReturn(
104-
false
105-
);
101+
$this->configMock->expects($this->once())
102+
->method('isSetFlag')
103+
->with(FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_PATH)
104+
->willReturn(false);
105+
106106
$this->assertEquals($this->_defaultFrontName, $this->model->getFrontName());
107107
}
108108

@@ -125,7 +125,12 @@ public function testIsHostBackend(
125125
string $customAdminUrl,
126126
bool $expectedValue
127127
): void {
128-
$this->scopeConfigMock->method('getValue')
128+
$this->scopeConfigMock
129+
->method('isSetFlag')
130+
->willReturn($useCustomAdminUrl);
131+
132+
$this->scopeConfigMock
133+
->method('getValue')
129134
->willReturnMap(
130135
[
131136
[Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
@@ -138,7 +143,7 @@ public function testIsHostBackend(
138143
],
139144
[
140145
FrontNameResolver::XML_PATH_CUSTOM_ADMIN_URL,
141-
ScopeInterface::SCOPE_STORE,
146+
ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
142147
null,
143148
$customAdminUrl
144149
]

app/code/Magento/Catalog/Block/Widget/Link.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function getHref()
8181
UrlRewrite::ENTITY_ID => $rewriteData[1],
8282
UrlRewrite::ENTITY_TYPE => $rewriteData[0],
8383
UrlRewrite::STORE_ID => $store->getId(),
84+
UrlRewrite::REDIRECT_TYPE => 0,
8485
];
8586
if (!empty($rewriteData[2]) && $rewriteData[0] == ProductUrlRewriteGenerator::ENTITY_TYPE) {
8687
$filterData[UrlRewrite::METADATA]['category_id'] = $rewriteData[2];

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
namespace Magento\Catalog\Model\ResourceModel\Product;
99

10+
use Magento\Catalog\Api\Data\ProductInterface;
1011
use Magento\Framework\DB\Adapter\AdapterInterface;
1112
use Magento\Framework\DB\Query\Generator;
1213
use Magento\Framework\DB\Select;
1314
use Magento\Framework\App\ResourceConnection;
15+
use Magento\Framework\EntityManager\MetadataPool;
1416

1517
/**
1618
* Class for retrieval of all product images
@@ -40,11 +42,13 @@ class Image
4042
/**
4143
* @param Generator $generator
4244
* @param ResourceConnection $resourceConnection
45+
* @param MetadataPool $metadataPool
4346
* @param int $batchSize
4447
*/
4548
public function __construct(
4649
Generator $generator,
4750
ResourceConnection $resourceConnection,
51+
private readonly MetadataPool $metadataPool,
4852
$batchSize = 100
4953
) {
5054
$this->batchQueryGenerator = $generator;
@@ -152,16 +156,32 @@ private function getVisibleImagesSelect(): Select
152156
*/
153157
private function getUsedImagesSelect(): Select
154158
{
155-
return $this->connection->select()->distinct()
159+
$productMetadata = $this->metadataPool->getMetadata(ProductInterface::class);
160+
$linkField = $productMetadata->getLinkField();
161+
$identifierField = $productMetadata->getIdentifierField();
162+
163+
$select = $this->connection->select()->distinct()
156164
->from(
157165
['images' => $this->resourceConnection->getTableName(Gallery::GALLERY_TABLE)],
158166
'value as filepath'
159167
)->joinInner(
160168
['image_value' => $this->resourceConnection->getTableName(Gallery::GALLERY_VALUE_TABLE)],
161169
'images.value_id = image_value.value_id',
162170
[]
171+
)->joinInner(
172+
['products' => $this->resourceConnection->getTableName('catalog_product_entity')],
173+
"image_value.$linkField = products.$linkField",
174+
[]
175+
)->joinInner(
176+
['websites' => $this->resourceConnection->getTableName('catalog_product_website')],
177+
"products.$identifierField = websites.product_id",
178+
['GROUP_CONCAT(websites.website_id SEPARATOR \',\') AS website_ids']
163179
)->where(
164180
'images.disabled = 0 AND image_value.disabled = 0'
181+
)->group(
182+
'websites.product_id'
165183
);
184+
185+
return $select;
166186
}
167187
}

app/code/Magento/Catalog/Test/Unit/Block/Widget/LinkTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ function ($route, $params) use ($storeId) {
240240
UrlRewrite::ENTITY_ID => 'entity_id',
241241
UrlRewrite::ENTITY_TYPE => 'entity_type',
242242
UrlRewrite::STORE_ID => $this->storeManager->getStore($storeId)->getStoreId(),
243+
UrlRewrite::REDIRECT_TYPE => 0,
243244
]
244245
)
245246
->willReturn($rewrite);
@@ -319,6 +320,7 @@ public function testGetHrefWithForProductWithCategoryIdParameter()
319320
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
320321
UrlRewrite::STORE_ID => $storeId,
321322
UrlRewrite::METADATA => ['category_id' => 'category_id'],
323+
UrlRewrite::REDIRECT_TYPE => 0,
322324
]
323325
)
324326
->willReturn(false);

0 commit comments

Comments
 (0)