Skip to content

Commit dfe5af4

Browse files
Merge branch '2.4-develop' into MC-40371
2 parents 22a78e3 + ad0ba79 commit dfe5af4

File tree

137 files changed

+2603
-287
lines changed

Some content is hidden

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

137 files changed

+2603
-287
lines changed

app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function execute()
3434
/** @var $export \Magento\ImportExport\Model\Export */
3535
$export = $this->_objectManager->create(\Magento\ImportExport\Model\Export::class);
3636
$export->setData($data);
37-
$export->filterAttributeCollection(
38-
$attrFilterBlock->prepareCollection($export->getEntityAttributeCollection())
37+
$attrFilterBlock->prepareCollection(
38+
$export->filterAttributeCollection($export->getEntityAttributeCollection())
3939
);
4040
return $resultLayout;
4141
} catch (\Exception $e) {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Model\Validator\UrlKey;
9+
10+
/**
11+
* Class Composite validates if urlKey doesn't matches frontName or restricted words(endpoint names)
12+
*/
13+
class CompositeUrlKey implements UrlKeyValidatorInterface
14+
{
15+
/**
16+
* @var UrlKeyValidatorInterface[]
17+
*/
18+
private $validators;
19+
20+
/**
21+
* @param array $validators
22+
*/
23+
public function __construct(
24+
array $validators = []
25+
) {
26+
$this->validators = $validators;
27+
}
28+
29+
/**
30+
* @inheritDoc
31+
*/
32+
public function validate(string $urlKey): array
33+
{
34+
$errors = [];
35+
foreach ($this->validators as $validator) {
36+
$errors[] = $validator->validate($urlKey);
37+
}
38+
39+
return array_merge([], ...$errors);
40+
}
41+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Model\Validator\UrlKey;
9+
10+
use Magento\Backend\App\Area\FrontNameResolver;
11+
12+
/**
13+
* Class FrontName validates if urlKey doesn't matches frontName
14+
*/
15+
class FrontName implements UrlKeyValidatorInterface
16+
{
17+
/**
18+
* @var FrontNameResolver
19+
*/
20+
private $frontNameResolver;
21+
22+
/**
23+
* @param FrontNameResolver $frontNameResolver
24+
*/
25+
public function __construct(
26+
FrontNameResolver $frontNameResolver
27+
) {
28+
$this->frontNameResolver = $frontNameResolver;
29+
}
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
public function validate(string $urlKey): array
35+
{
36+
$errors = [];
37+
$frontName = $this->frontNameResolver->getFrontName();
38+
if ($urlKey == $frontName) {
39+
$errors[] = __(
40+
'URL key "%1" matches a reserved endpoint name (%2). Use another URL key.',
41+
$urlKey,
42+
$frontName
43+
);
44+
}
45+
46+
return $errors;
47+
}
48+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Model\Validator\UrlKey;
9+
10+
use Magento\Framework\Validator\UrlKey;
11+
12+
/**
13+
* Class RestrictedWords validates if urlKey doesn't matches restricted words(endpoint names)
14+
*/
15+
class RestrictedWords implements UrlKeyValidatorInterface
16+
{
17+
/**
18+
* @var UrlKey
19+
*/
20+
private $urlKey;
21+
22+
/**
23+
* @param UrlKey $urlKey
24+
*/
25+
public function __construct(
26+
UrlKey $urlKey
27+
) {
28+
$this->urlKey = $urlKey;
29+
}
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
public function validate(string $urlKey): array
35+
{
36+
$errors = [];
37+
if (!$this->urlKey->isValid($urlKey)) {
38+
$errors[] = __(
39+
'URL key "%1" matches a reserved endpoint name (%2). Use another URL key.',
40+
$urlKey,
41+
implode(', ', $this->urlKey->getRestrictedValues())
42+
);
43+
}
44+
45+
return $errors;
46+
}
47+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Model\Validator\UrlKey;
9+
10+
/**
11+
* Interface UrlKeyValidatorInterface is responsive for validating urlKeys
12+
*/
13+
interface UrlKeyValidatorInterface
14+
{
15+
/**
16+
* Validates urlKey
17+
*
18+
* @param string $urlKey
19+
* @return array
20+
*/
21+
public function validate(string $urlKey): array;
22+
}

app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
7070
<!-- Place Order -->
7171
<comment userInput="Place order" stepKey="placeOrder"/>
72-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
73-
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
72+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
73+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSuccessTitle"/>
7474
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order number is: " stepKey="seeOrderNumber"/>
7575
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
7676
<!-- Search for Order in the order grid -->

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,12 @@
188188
<argument name="anchorRenderer" xsi:type="object">Magento\Backend\Block\AnchorRenderer</argument>
189189
</arguments>
190190
</type>
191+
<type name="Magento\Backend\Model\Validator\UrlKey\CompositeUrlKey">
192+
<arguments>
193+
<argument name="validators" xsi:type="array">
194+
<item name="frontNameValidator" xsi:type="object">Magento\Backend\Model\Validator\UrlKey\FrontName</item>
195+
<item name="restrictedWordsValidator" xsi:type="object">Magento\Backend\Model\Validator\UrlKey\RestrictedWords</item>
196+
</argument>
197+
</arguments>
198+
</type>
191199
</config>

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,3 +466,4 @@ Pagination,Pagination
466466
"Theme Name","Theme Name"
467467
"Use URL parameter to enable template path hints for Storefront","Use URL parameter to enable template path hints for Storefront"
468468
"Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]","Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]"
469+
"URL key "%1" matches a reserved endpoint name (%2). Use another URL key.","URL key "%1" matches a reserved endpoint name (%2). Use another URL key."

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Catalog\Model;
78

89
use Magento\Framework\App\Filesystem\DirectoryList;
9-
use Magento\Framework\Exception\LocalizedException;
10-
use Magento\Framework\File\Uploader;
1110
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Exception\LocalizedException;
1212
use Magento\Framework\File\Name;
1313
use Magento\Framework\Filesystem;
1414
use Magento\Framework\Filesystem\Directory\WriteInterface;
@@ -211,7 +211,7 @@ public function moveFileFromTmp($imageName, $returnRelativePath = false)
211211
$baseTmpImagePath = $this->getFilePath($baseTmpPath, $imageName);
212212

213213
try {
214-
$this->coreFileStorageDatabase->copyFile(
214+
$this->coreFileStorageDatabase->renameFile(
215215
$baseTmpImagePath,
216216
$baseImagePath
217217
);

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -504,21 +504,17 @@ public function processFileQueue()
504504
/** @var $uploader \Zend_File_Transfer_Adapter_Http */
505505
$uploader = $queueOptions['uploader'] ?? null;
506506
$isUploaded = false;
507-
if ($uploader && $uploader->isValid()) {
507+
if ($uploader && $uploader->isValid($src)) {
508+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
508509
$path = pathinfo($dst, PATHINFO_DIRNAME);
509510
$uploader = $this->uploaderFactory->create(['fileId' => $src]);
510511
$uploader->setFilesDispersion(false);
511512
$uploader->setAllowRenameFiles(true);
513+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
512514
$isUploaded = $uploader->save($path, pathinfo($dst, PATHINFO_FILENAME));
513515
}
514516

515517
if (empty($src) || empty($dst) || !$isUploaded) {
516-
/**
517-
* @todo: show invalid option
518-
*/
519-
if (isset($queueOptions['option'])) {
520-
$queueOptions['option']->setIsValid(false);
521-
}
522518
throw new \Magento\Framework\Exception\LocalizedException(
523519
__('The file upload failed. Try to upload again.')
524520
);

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@
120120
<!--Select payment method-->
121121
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
122122
<!-- Place Order -->
123-
<waitForElementVisible selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
124-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
125-
123+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPlaceOrderButton"/>
124+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
126125
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
127126

128127
<!-- Login to Admin and open Order -->

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitleTest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@
8989
<!-- Place Order -->
9090

9191
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
92-
<waitForElementVisible selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
93-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
94-
92+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPlaceOrderButton"/>
93+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
9594
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
9695

9796
<!-- Login to Admin and open Order -->

app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
110110
<!-- Checkout select Check/Money Order payment -->
111111
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
112-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
113-
<waitForPageLoad stepKey="waitForOrderSuccessPage1"/>
112+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
113+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForOrderSuccessPage1"/>
114114
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
115115
<actionGroup ref="StorefrontSignOutActionGroup" stepKey="StorefrontSignOutActionGroup"/>
116116
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest/AdvanceCatalogSearchSimpleProductByDescriptionTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
<features value="CatalogSearch"/>
1313
<group value="CatalogSearch"/>
1414
</annotations>
15-
<!-- Perform reindex and flush cache -->
1615
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
17-
<argument name="indices" value=""/>
16+
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
1817
</actionGroup>
1918
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
2019
<argument name="tags" value=""/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest/AdvanceCatalogSearchSimpleProductByNameTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
<group value="CatalogSearch"/>
1414
</annotations>
1515

16-
<!-- Perform reindex and flush cache -->
1716
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
18-
<argument name="indices" value=""/>
17+
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
1918
</actionGroup>
2019
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
2120
<argument name="tags" value=""/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest/AdvanceCatalogSearchSimpleProductByPriceTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
<group value="CatalogSearch"/>
1414
</annotations>
1515

16-
<!-- Perform reindex and flush cache -->
1716
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
18-
<argument name="indices" value=""/>
17+
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
1918
</actionGroup>
2019
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
2120
<argument name="tags" value=""/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest/AdvanceCatalogSearchSimpleProductByShortDescriptionTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
<group value="CatalogSearch"/>
1414
</annotations>
1515

16-
<!-- Perform reindex and flush cache -->
1716
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
18-
<argument name="indices" value=""/>
17+
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
1918
</actionGroup>
2019
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
2120
<argument name="tags" value=""/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest/AdvanceCatalogSearchSimpleProductBySkuTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
<group value="CatalogSearch"/>
1414
</annotations>
1515

16-
<!-- Perform reindex and flush cache -->
1716
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
18-
<argument name="indices" value=""/>
17+
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
1918
</actionGroup>
2019
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
2120
<argument name="tags" value=""/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartBundleDynamicTest.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@
4343
</actionGroup>
4444
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
4545

46-
<!-- Perform reindex and flush cache -->
47-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
48-
<argument name="indices" value=""/>
49-
</actionGroup>
46+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
5047
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
5148
<argument name="tags" value=""/>
5249
</actionGroup>

app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartBundleFixedTest.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@
5454
</actionGroup>
5555
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
5656

57-
<!-- Perform reindex and flush cache -->
58-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
59-
<argument name="indices" value=""/>
60-
</actionGroup>
57+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
6158
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
6259
<argument name="tags" value=""/>
6360
</actionGroup>

app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartConfigurableTest.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
<argument name="category" value="$$createCategory$$"/>
2626
</actionGroup>
2727

28-
<!-- Perform reindex and flush cache -->
29-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
30-
<argument name="indices" value=""/>
31-
</actionGroup>
28+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
3229
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
3330
<argument name="tags" value=""/>
3431
</actionGroup>

app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartDownloadableTest.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
<requiredEntity createDataKey="createProduct"/>
2828
</createData>
2929

30-
<!-- Perform reindex and flush cache -->
31-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
32-
<argument name="indices" value=""/>
33-
</actionGroup>
30+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
3431
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
3532
<argument name="tags" value=""/>
3633
</actionGroup>

0 commit comments

Comments
 (0)