Skip to content

Commit 5ab2114

Browse files
authored
Merge pull request #7712 from magento-amigos/2.4-develop-prs
[Amigos] Community Contributions - 2.4-develop
2 parents 0d9d534 + 9878297 commit 5ab2114

File tree

23 files changed

+393
-162
lines changed

23 files changed

+393
-162
lines changed

app/code/Magento/Analytics/Model/ExportDataHandler.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Framework\App\Filesystem\DirectoryList;
1010
use Magento\Framework\Archive;
11+
use Magento\Framework\Exception\FileSystemException;
1112
use Magento\Framework\Exception\LocalizedException;
1213
use Magento\Framework\Filesystem;
1314
use Magento\Framework\Filesystem\Directory\WriteInterface;
@@ -89,8 +90,7 @@ public function __construct(
8990
public function prepareExportData()
9091
{
9192
try {
92-
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
93-
93+
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::TMP);
9494
$this->prepareDirectory($tmpDirectory, $this->getTmpFilesDirRelativePath());
9595
$this->reportWriter->write($tmpDirectory, $this->getTmpFilesDirRelativePath());
9696

@@ -106,8 +106,10 @@ public function prepareExportData()
106106
$this->cryptographer->encode($tmpDirectory->readFile($this->getArchiveRelativePath()))
107107
);
108108
} finally {
109-
$tmpDirectory->delete($this->getTmpFilesDirRelativePath());
110-
$tmpDirectory->delete($this->getArchiveRelativePath());
109+
if (isset($tmpDirectory)) {
110+
$tmpDirectory->delete($this->getTmpFilesDirRelativePath());
111+
$tmpDirectory->delete($this->getArchiveRelativePath());
112+
}
111113
}
112114

113115
return true;

app/code/Magento/Analytics/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Magento_Analytics module
22

3-
The Magento_Analytics module integrates your Magento instance with the [Magento Business Intelligence (MBI)](https://magento.com/products/business-intelligence) to use [Advanced Reporting](https://devdocs.magento.com/guides/v2.4/advanced-reporting/modules.html) functionality.
3+
The Magento_Analytics module integrates your Magento instance with the [Magento Business Intelligence (MBI)](https://business.adobe.com/products/magento/business-intelligence.html) to use [Advanced Reporting](https://devdocs.magento.com/guides/v2.4/advanced-reporting/modules.html) functionality.
44

55
The module implements the following functionality:
66

app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\Framework\Archive;
1616
use Magento\Framework\Filesystem;
1717
use Magento\Framework\Filesystem\Directory\WriteInterface;
18-
use Magento\Framework\Filesystem\DirectoryList;
18+
use Magento\Framework\App\Filesystem\DirectoryList;
1919
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
2020
use PHPUnit\Framework\MockObject\MockObject;
2121
use PHPUnit\Framework\TestCase;
@@ -127,7 +127,7 @@ public function testPrepareExportData($isArchiveSourceDirectory)
127127
$this->filesystemMock
128128
->expects($this->once())
129129
->method('getDirectoryWrite')
130-
->with(DirectoryList::SYS_TMP)
130+
->with(DirectoryList::TMP)
131131
->willReturn($this->directoryMock);
132132
$this->directoryMock
133133
->expects($this->exactly(4))
@@ -228,7 +228,7 @@ public function testPrepareExportDataWithLocalizedException()
228228
$this->filesystemMock
229229
->expects($this->once())
230230
->method('getDirectoryWrite')
231-
->with(DirectoryList::SYS_TMP)
231+
->with(DirectoryList::TMP)
232232
->willReturn($this->directoryMock);
233233
$this->reportWriterMock
234234
->expects($this->once())

app/code/Magento/Backend/etc/menu.xsd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<xs:simpleType name="typeId">
8686
<xs:annotation>
8787
<xs:documentation>
88-
Item id attribute can has only [a-z0-9/_]. Minimal length 3 symbol. Case insensitive.
88+
Item id attribute can have only [a-z0-9/_]. Minimal length 3 characters. Case insensitive.
8989
</xs:documentation>
9090
</xs:annotation>
9191
<xs:restriction base="xs:string">
@@ -96,7 +96,7 @@
9696
<xs:simpleType name="typeAction">
9797
<xs:annotation>
9898
<xs:documentation>
99-
Item action attribute can has only [a-zA-Z0-9/_]. Minimal length 3 symbol
99+
Item action attribute can have only [a-zA-Z0-9/_]. Minimal length 3 characters.
100100
</xs:documentation>
101101
</xs:annotation>
102102
<xs:restriction base="xs:string">
@@ -107,7 +107,7 @@
107107
<xs:simpleType name="typeTitle">
108108
<xs:annotation>
109109
<xs:documentation>
110-
Item title attribute minimal length 3 symbol
110+
Item title attribute minimal length 3 characters.
111111
</xs:documentation>
112112
</xs:annotation>
113113
<xs:restriction base="xs:string">
@@ -119,7 +119,7 @@
119119
<xs:simpleType name="typeModule">
120120
<xs:annotation>
121121
<xs:documentation>
122-
Item module attribute can has only [a-z0-9_]. Minimal length 3 symbol. Case insensitive.
122+
Item module attribute can have only [a-z0-9_]. Minimal length 3 characters. Case insensitive.
123123
</xs:documentation>
124124
</xs:annotation>
125125
<xs:restriction base="xs:string">
@@ -130,7 +130,7 @@
130130
<xs:simpleType name="typeResource">
131131
<xs:annotation>
132132
<xs:documentation>
133-
Item resource attribute can has only [a-z0-9_]. Minimal length 3 symbol. Case insensitive.
133+
Item resource attribute can have only [a-z0-9_]. Minimal length 3 characters. Case insensitive.
134134
</xs:documentation>
135135
</xs:annotation>
136136
<xs:restriction base="xs:string">
@@ -141,7 +141,7 @@
141141
<xs:simpleType name="typeDependsConfig">
142142
<xs:annotation>
143143
<xs:documentation>
144-
Item resource attribute can has only [a-z0-9_]. Minimal length 3 symbol. Case insensitive.
144+
Item dependsOnConfig attribute can have only [a-z0-9_]. Minimal length 3 characters. Case insensitive.
145145
</xs:documentation>
146146
</xs:annotation>
147147
<xs:restriction base="xs:string">

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
use Magento\Catalog\Api\Data\ProductInterface;
1212
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface as OptionRepository;
1313
use Magento\Catalog\Model\Product\Option;
14+
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1415
use Magento\Framework\App\ObjectManager;
1516
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
16-
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1717
use Magento\Framework\Exception\CouldNotSaveException;
1818

1919
/**
@@ -26,12 +26,12 @@ class SaveHandler implements ExtensionInterface
2626
/**
2727
* @var string[]
2828
*/
29-
private $compositeProductTypes = ['grouped', 'configurable', 'bundle'];
29+
private array $compositeProductTypes = ['grouped', 'configurable', 'bundle'];
3030

3131
/**
3232
* @var OptionRepository
3333
*/
34-
protected $optionRepository;
34+
protected OptionRepository $optionRepository;
3535

3636
/**
3737
* @var Relation
@@ -44,7 +44,7 @@ class SaveHandler implements ExtensionInterface
4444
*/
4545
public function __construct(
4646
OptionRepository $optionRepository,
47-
?Relation $relation = null
47+
?Relation $relation = null
4848
) {
4949
$this->optionRepository = $optionRepository;
5050
$this->relation = $relation ?: ObjectManager::getInstance()->get(Relation::class);
@@ -57,6 +57,7 @@ public function __construct(
5757
* @param array $arguments
5858
* @return ProductInterface|object
5959
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
60+
* @throws CouldNotSaveException
6061
*/
6162
public function execute($entity, $arguments = [])
6263
{
@@ -122,12 +123,11 @@ private function processOptionsSaving(array $options, bool $hasChangedSku, Produ
122123
private function isProductHasRelations(ProductInterface $product): bool
123124
{
124125
$result = true;
125-
if (!in_array($product->getId(), $this->compositeProductTypes)
126+
if (!in_array($product->getTypeId(), $this->compositeProductTypes)
126127
&& $this->relation->getRelationsByChildren([$product->getId()])
127128
) {
128129
$result = false;
129130
}
130-
131131
return $result;
132132
}
133133
}

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ $_helper = $block->getData('outputHelper');
8686
<form data-role="tocart-form"
8787
data-product-sku="<?= $escaper->escapeHtml($_product->getSku()) ?>"
8888
action="<?= $escaper->escapeUrl($postParams['action']) ?>"
89+
data-mage-init='{"catalogAddToCart": {}}'
8990
method="post">
9091
<?php $options = $block->getData('viewModel')->getOptionsData($_product); ?>
9192
<?php foreach ($options as $optionItem): ?>
@@ -161,13 +162,4 @@ $_helper = $block->getData('outputHelper');
161162
</div>
162163
<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>
163164
<?php // phpcs:ignore Magento2.Legacy.PhtmlTemplate ?>
164-
<script type="text/x-magento-init">
165-
{
166-
"[data-role=tocart-form], .form.map.checkout": {
167-
"catalogAddToCart": {
168-
"product_sku": "<?= $escaper->escapeJs($_product->getSku()) ?>"
169-
}
170-
}
171-
}
172-
</script>
173165
<?php endif; ?>

app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ define([
5353
isCustomerLoggedIn: customer.isLoggedIn,
5454
forgotPasswordUrl: window.checkoutConfig.forgotPasswordUrl,
5555
emailCheckTimeout: 0,
56+
emailInputId: '#customer-email',
5657

5758
/**
5859
* Initializes regular properties of instance.
@@ -108,6 +109,8 @@ define([
108109
checkEmailAvailability: function () {
109110
this.validateRequest();
110111
this.isEmailCheckComplete = $.Deferred();
112+
// Clean up errors on email
113+
$(this.emailInputId).removeClass('mage-error').parent().find('.mage-error').remove();
111114
this.isLoading(true);
112115
this.checkRequest = checkEmailAvailability(this.isEmailCheckComplete, this.email());
113116

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
10+
<event name="customer_login">
11+
<observer name="customer_log_login" instance="Magento\Customer\Observer\LogLastLoginAtObserver" />
12+
</event>
13+
</config>

app/code/Magento/Indexer/Console/Command/IndexerResetStateCommand.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
use Symfony\Component\Console\Input\InputInterface;
1111
use Symfony\Component\Console\Output\OutputInterface;
1212
use Magento\Framework\Indexer\ConfigInterface;
13+
use Magento\Framework\Console\Cli;
1314

1415
/**
1516
* Command for invalidating indexers.
1617
*/
1718
class IndexerResetStateCommand extends AbstractIndexerManageCommand
1819
{
1920
/**
20-
* {@inheritdoc}
21+
* Configures the current command.
2122
*/
2223
protected function configure()
2324
{
@@ -29,16 +30,18 @@ protected function configure()
2930
}
3031

3132
/**
32-
* {@inheritdoc}
33+
* Invalidate / reset the indexer
34+
*
35+
* @param InputInterface $input
36+
* @param OutputInterface $output
37+
* @return int
3338
*/
3439
protected function execute(InputInterface $input, OutputInterface $output)
3540
{
3641
$indexers = $this->getIndexers($input);
3742
foreach ($indexers as $indexer) {
3843
try {
39-
$indexer->getState()
40-
->setStatus(\Magento\Framework\Indexer\StateInterface::STATUS_INVALID)
41-
->save();
44+
$indexer->invalidate();
4245
$output->writeln($indexer->getTitle() . ' indexer has been invalidated.');
4346
} catch (LocalizedException $e) {
4447
$output->writeln($e->getMessage());
@@ -47,5 +50,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
4750
$output->writeln($e->getMessage());
4851
}
4952
}
53+
return Cli::RETURN_SUCCESS;
5054
}
5155
}

app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerResetStateCommandTest.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,17 @@ class IndexerResetStateCommandTest extends AbstractIndexerCommandCommonSetup
2222
*/
2323
private $command;
2424

25-
protected function setUp(): void
26-
{
27-
parent::setUp();
28-
$this->stateMock->expects($this->once())->method('setAreaCode')->with(FrontNameResolver::AREA_CODE);
29-
}
30-
3125
public function testExecute()
3226
{
3327
$this->configureAdminArea();
3428
$indexerOne = $this->getIndexerMock(
35-
['getState'],
29+
['invalidate'],
3630
['indexer_id' => 'indexer_1', 'title' => 'Title_indexerOne']
3731
);
3832
$this->initIndexerCollectionByItems([$indexerOne]);
3933

40-
$stateMock = $this->createMock(State::class);
41-
$stateMock->expects($this->exactly(1))
42-
->method('setStatus')
43-
->with(StateInterface::STATUS_INVALID)->willReturnSelf();
44-
45-
$stateMock->expects($this->exactly(1))
46-
->method('save');
47-
4834
$indexerOne->expects($this->once())
49-
->method('getState')
50-
->willReturn($stateMock);
35+
->method('invalidate');
5136

5237
$this->command = new IndexerResetStateCommand($this->objectManagerFactory);
5338
$commandTester = new CommandTester($this->command);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
</depends>
6969
</field>
7070
<field id="separate_apps" translate="label comment" type="select" sortOrder="9" showInDefault="1" showInWebsite="1" showInStore="1">
71-
<label>Send Adminhtml and Frontend as Separate Apps</label>
71+
<label>Send each Magento Area Code as Separate App</label>
7272
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
73-
<comment>In addition to the main app (which includes all PHP execution), separate apps for adminhtml and frontend will be created. Requires New Relic Application Name to be set.</comment>
73+
<comment>In addition to the main app (which includes all PHP execution), separate apps for each Magento area code (adminhtml, frontend, ...) will be created. Requires New Relic Application Name to be set.</comment>
7474
<depends>
7575
<field id="enable">1</field>
7676
</depends>

0 commit comments

Comments
 (0)