Skip to content

Commit 5aba121

Browse files
authored
Merge branch '2.4-develop' into issue/39743-cms-page-error-log-fix
2 parents 2c1b4db + 3ad96f6 commit 5aba121

File tree

44 files changed

+775
-140
lines changed

Some content is hidden

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

44 files changed

+775
-140
lines changed

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);

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/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);

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/MediaGalleryProcessor.php

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

@@ -51,7 +51,9 @@ public function process(
5151
array $attributeNames,
5252
?ContextInterface $context = null
5353
): Collection {
54-
if (in_array('media_gallery_entries', $attributeNames)) {
54+
if (in_array('media_gallery_entries', $attributeNames) ||
55+
in_array('media_gallery', $attributeNames)
56+
) {
5557
$mediaAttributes = $this->mediaConfig->getMediaAttributeCodes();
5658
foreach ($mediaAttributes as $mediaAttribute) {
5759
if (!in_array($mediaAttribute, $attributeNames)) {

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ interface MediaGalleryInterface @doc(description: "Contains basic information ab
229229
label: String @doc(description: "The label of the product image or video.")
230230
position: Int @doc(description: "The media item's position after it has been sorted.")
231231
disabled: Boolean @doc(description: "Indicates whether the image is hidden from view.")
232+
types: [String] @doc(description: "Array of image types. It can have the following values: image, small_image, thumbnail.")
232233
}
233234

234235
type ProductImage implements MediaGalleryInterface @doc(description: "Contains product image information, including the image URL and label.") {

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,13 +1004,13 @@ public function export()
10041004
++$page;
10051005
$entityCollection = $this->_getEntityCollection(true);
10061006
$entityCollection->setOrder('entity_id', 'asc');
1007-
$entityCollection->setStoreId(Store::DEFAULT_STORE_ID);
10081007
$this->_prepareEntityCollection($entityCollection);
10091008
$this->paginateCollection($page, $this->getItemsPerPage());
1010-
if ($entityCollection->count() == 0) {
1009+
1010+
$exportData = $this->getExportData();
1011+
if ($exportData == null || count($exportData) == 0) {
10111012
break;
10121013
}
1013-
$exportData = $this->getExportData();
10141014
if ($page == 1) {
10151015
$writer->setHeaderCols($this->_getHeaderColumns());
10161016
}
@@ -1096,10 +1096,11 @@ protected function getExportData()
10961096
protected function loadCollection(): array
10971097
{
10981098
$data = [];
1099-
$collection = $this->_getEntityCollection();
11001099
foreach (array_keys($this->_storeIdToCode) as $storeId) {
1100+
$collection = $this->_getEntityCollection(true);
11011101
$collection->setOrder('entity_id', 'asc');
11021102
$collection->setStoreId($storeId);
1103+
$this->_prepareEntityCollection($collection);
11031104
$collection->load();
11041105
foreach ($collection as $itemId => $item) {
11051106
$data[$itemId][$storeId] = $item;
@@ -1129,6 +1130,9 @@ protected function collectRawData()
11291130
*/
11301131
foreach ($items as $itemId => $itemByStore) {
11311132
foreach ($this->_storeIdToCode as $storeId => $storeCode) {
1133+
if (!key_exists($storeId, $itemByStore)) {
1134+
continue;
1135+
}
11321136
$item = $itemByStore[$storeId];
11331137
$additionalAttributes = [];
11341138
$productLinkId = $item->getData($this->getProductEntityLinkField());

app/code/Magento/CatalogImportExport/Test/Unit/Model/Export/ProductTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,12 @@ public function testExportCountZeroBreakInternalCalls()
342342
$this->product->expects($this->once())->method('getItemsPerPage')->willReturn($itemsPerPage);
343343
$this->product->expects($this->once())->method('paginateCollection')->with($page, $itemsPerPage);
344344
$this->abstractCollection->expects($this->once())->method('setOrder')->with('entity_id', 'asc');
345-
$this->abstractCollection->expects($this->once())->method('setStoreId')->with(Store::DEFAULT_STORE_ID);
346-
347-
$this->abstractCollection->expects($this->once())->method('count')->willReturn(0);
348345

349346
$this->abstractCollection->expects($this->never())->method('getCurPage');
350347
$this->abstractCollection->expects($this->never())->method('getLastPageNumber');
351348
$this->product->expects($this->never())->method('_getHeaderColumns');
352349
$this->writer->expects($this->never())->method('setHeaderCols');
353350
$this->writer->expects($this->never())->method('writeRow');
354-
$this->product->expects($this->never())->method('getExportData');
355351
$this->product->expects($this->never())->method('_customFieldsMapping');
356352

357353
$this->writer->expects($this->once())->method('getContents');
@@ -373,9 +369,6 @@ public function testExportCurPageEqualToLastBreakInternalCalls()
373369
$this->product->expects($this->once())->method('getItemsPerPage')->willReturn($itemsPerPage);
374370
$this->product->expects($this->once())->method('paginateCollection')->with($page, $itemsPerPage);
375371
$this->abstractCollection->expects($this->once())->method('setOrder')->with('entity_id', 'asc');
376-
$this->abstractCollection->expects($this->once())->method('setStoreId')->with(Store::DEFAULT_STORE_ID);
377-
378-
$this->abstractCollection->expects($this->once())->method('count')->willReturn(1);
379372

380373
$this->abstractCollection->expects($this->once())->method('getCurPage')->willReturn($curPage);
381374
$this->abstractCollection->expects($this->once())->method('getLastPageNumber')->willReturn($lastPage);

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,8 @@ public function getUsedProductIds($product)
552552
{
553553
if (!$product->hasData($this->_usedProductIds)) {
554554
$usedProductIds = [];
555-
foreach ($this->getUsedProducts($product) as $product) {
556-
$usedProductIds[] = $product->getId();
555+
foreach ($this->getUsedProducts($product) as $childProduct) {
556+
$usedProductIds[] = $childProduct->getId();
557557
}
558558
$product->setData($this->_usedProductIds, $usedProductIds);
559559
}

app/code/Magento/Customer/Controller/Account/Confirmation.php

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

@@ -99,10 +99,7 @@ public function execute()
9999
);
100100
$this->messageManager->addSuccessMessage(__('Please check your email for confirmation key.'));
101101
return $this->getRedirect('*/*/index', ['_secure' => true]);
102-
} catch (InvalidTransitionException $e) {
103-
$this->messageManager->addSuccessMessage(__('This email does not require confirmation.'));
104-
return $this->getRedirect('*/*/index', ['_secure' => true]);
105-
} catch (NoSuchEntityException $e) {
102+
} catch (InvalidTransitionException | NoSuchEntityException $e) {
106103
$this->messageManager->addErrorMessage(__('Wrong email.'));
107104
}
108105
}

0 commit comments

Comments
 (0)