Skip to content

Commit ec7d845

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into EPAM-PR-2
2 parents 949040e + 9d6399e commit ec7d845

File tree

10 files changed

+143
-33
lines changed

10 files changed

+143
-33
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
4646
<?php /** @var $_product \Magento\Catalog\Model\Product */ ?>
4747
<?php foreach ($_productCollection as $_product): ?>
4848
<li class="item product product-item">
49-
<div class="product-item-info" data-container="product-grid">
49+
<div class="product-item-info" data-container="product-<?= /* @escapeNotVerified */ $viewMode ?>">
5050
<?php
5151
$productImage = $block->getImage($_product, $imageDisplayArea);
5252
if ($pos != null) {

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,8 +812,12 @@ public function place($token, $shippingMethodCode = null)
812812
case \Magento\Sales\Model\Order::STATE_PROCESSING:
813813
case \Magento\Sales\Model\Order::STATE_COMPLETE:
814814
case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW:
815-
if (!$order->getEmailSent()) {
816-
$this->orderSender->send($order);
815+
try {
816+
if (!$order->getEmailSent()) {
817+
$this->orderSender->send($order);
818+
}
819+
} catch (\Exception $e) {
820+
$this->_logger->critical($e);
817821
}
818822
$this->_checkoutSession->start();
819823
break;

app/code/Magento/Review/Controller/Product/ListAjax.php

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

8-
use Magento\Framework\Exception\LocalizedException;
9+
use Magento\Framework\App\ResponseInterface;
10+
use Magento\Framework\Controller\ResultInterface;
11+
use Magento\Framework\View\Result\Layout;
912
use Magento\Review\Controller\Product as ProductController;
1013
use Magento\Framework\Controller\ResultFactory;
1114

@@ -14,17 +17,16 @@ class ListAjax extends ProductController
1417
/**
1518
* Show list of product's reviews
1619
*
17-
* @return \Magento\Framework\View\Result\Layout
20+
* @return ResponseInterface|ResultInterface|Layout
1821
*/
1922
public function execute()
2023
{
2124
if (!$this->initProduct()) {
22-
throw new LocalizedException(__("The product can't be initialized."));
23-
} else {
24-
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
25-
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
25+
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
26+
$resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
27+
return $resultForward->forward('noroute');
2628
}
2729

28-
return $resultLayout;
30+
return $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
2931
}
3032
}

app/code/Magento/Sales/Model/EmailSenderHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ public function sendEmails()
9090
if ($this->globalConfig->getValue('sales_email/general/async_sending')) {
9191
$this->entityCollection->addFieldToFilter('send_email', ['eq' => 1]);
9292
$this->entityCollection->addFieldToFilter('email_sent', ['null' => true]);
93+
$this->entityCollection->setPageSize(
94+
$this->globalConfig->getValue('sales_email/general/sending_limit')
95+
);
9396

9497
/** @var \Magento\Store\Api\Data\StoreInterface[] $stores */
9598
$stores = $this->getStores(clone $this->entityCollection);

app/code/Magento/Sales/Test/Unit/Model/EmailSenderHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testExecute($configValue, $collectionItems, $emailSendingResult)
118118
$path = 'sales_email/general/async_sending';
119119

120120
$this->globalConfig
121-
->expects($this->once())
121+
->expects($this->at(0))
122122
->method('getValue')
123123
->with($path)
124124
->willReturn($configValue);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@
132132
<source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
133133
<backend_model>Magento\Sales\Model\Config\Backend\Email\AsyncSending</backend_model>
134134
</field>
135+
<field id="sending_limit" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
136+
<label>Limit per cron run</label>
137+
<comment>Limit how many entities (orders/shipments/etc) will be processed during one cron run.</comment>
138+
<validate>required-number validate-number validate-greater-than-zero</validate>
139+
<depends>
140+
<field id="async_sending">1</field>
141+
</depends>
142+
</field>
135143
</group>
136144
<group id="order" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
137145
<label>Order</label>

app/code/Magento/Sales/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<sales_email>
3030
<general>
3131
<async_sending>0</async_sending>
32+
<sending_limit>50</sending_limit>
3233
</general>
3334
<order>
3435
<enabled>1</enabled>

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,43 +354,43 @@
354354

355355
<virtualType name="SalesOrderSendEmailsObserver" type="Magento\Sales\Observer\Virtual\SendEmails">
356356
<arguments>
357-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderSendEmails</argument>
357+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderSendEmails</argument>
358358
</arguments>
359359
</virtualType>
360360
<virtualType name="SalesOrderInvoiceSendEmailsObserver" type="Magento\Sales\Observer\Virtual\SendEmails">
361361
<arguments>
362-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderInvoiceSendEmails</argument>
362+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderInvoiceSendEmails</argument>
363363
</arguments>
364364
</virtualType>
365365
<virtualType name="SalesOrderShipmentSendEmailsObserver" type="Magento\Sales\Observer\Virtual\SendEmails">
366366
<arguments>
367-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderShipmentSendEmails</argument>
367+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderShipmentSendEmails</argument>
368368
</arguments>
369369
</virtualType>
370370
<virtualType name="SalesOrderCreditmemoSendEmailsObserver" type="Magento\Sales\Observer\Virtual\SendEmails">
371371
<arguments>
372-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderCreditmemoSendEmails</argument>
372+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderCreditmemoSendEmails</argument>
373373
</arguments>
374374
</virtualType>
375375

376376
<virtualType name="SalesOrderSendEmailsCron" type="Magento\Sales\Cron\SendEmails">
377377
<arguments>
378-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderSendEmails</argument>
378+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderSendEmails</argument>
379379
</arguments>
380380
</virtualType>
381381
<virtualType name="SalesInvoiceSendEmailsCron" type="Magento\Sales\Cron\SendEmails">
382382
<arguments>
383-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderInvoiceSendEmails</argument>
383+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderInvoiceSendEmails</argument>
384384
</arguments>
385385
</virtualType>
386386
<virtualType name="SalesShipmentSendEmailsCron" type="Magento\Sales\Cron\SendEmails">
387387
<arguments>
388-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderShipmentSendEmails</argument>
388+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderShipmentSendEmails</argument>
389389
</arguments>
390390
</virtualType>
391391
<virtualType name="SalesCreditmemoSendEmailsCron" type="Magento\Sales\Cron\SendEmails">
392392
<arguments>
393-
<argument name="emailSenderHandler" xsi:type="object">SalesOrderCreditmemoSendEmails</argument>
393+
<argument name="emailSenderHandler" xsi:type="object" shared="false">SalesOrderCreditmemoSendEmails</argument>
394394
</arguments>
395395
</virtualType>
396396
<type name="Magento\SalesSequence\Model\EntityPool">

app/code/Magento/Ui/view/frontend/web/js/model/messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ define([
5555
return messageObj.parameters.shift();
5656
});
5757
this.clear();
58-
this.errorMessages.push(message);
58+
type.push(message);
5959

6060
return true;
6161
},

setup/src/Magento/Setup/Console/Command/ModuleStatusCommand.php

Lines changed: 105 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Setup\Console\Command;
710

11+
use Magento\Framework\Module\FullModuleList;
12+
use Magento\Framework\Module\ModuleList;
813
use Magento\Setup\Model\ObjectManagerProvider;
14+
use Magento\Framework\Console\Cli;
915
use Symfony\Component\Console\Input\InputInterface;
1016
use Symfony\Component\Console\Output\OutputInterface;
17+
use Symfony\Component\Console\Input\InputArgument;
1118

1219
/**
1320
* Command for displaying status of modules
@@ -38,7 +45,10 @@ public function __construct(ObjectManagerProvider $objectManagerProvider)
3845
protected function configure()
3946
{
4047
$this->setName('module:status')
41-
->setDescription('Displays status of modules');
48+
->setDescription('Displays status of modules')
49+
->addArgument('module', InputArgument::OPTIONAL, 'Optional module name')
50+
->addOption('enabled', null, null, 'Print only enabled modules')
51+
->addOption('disabled', null, null, 'Print only disabled modules');
4252
parent::configure();
4353
}
4454

@@ -47,24 +57,106 @@ protected function configure()
4757
*/
4858
protected function execute(InputInterface $input, OutputInterface $output)
4959
{
50-
$moduleList = $this->objectManagerProvider->get()->create(\Magento\Framework\Module\ModuleList::class);
51-
$output->writeln('<info>List of enabled modules:</info>');
52-
$enabledModules = $moduleList->getNames();
53-
if (count($enabledModules) === 0) {
54-
$output->writeln('None');
55-
} else {
56-
$output->writeln(join("\n", $enabledModules));
60+
$moduleName = (string)$input->getArgument('module');
61+
if ($moduleName) {
62+
return $this->showSpecificModule($moduleName, $output);
5763
}
64+
65+
$onlyEnabled = $input->getOption('enabled');
66+
if ($onlyEnabled) {
67+
return $this->showEnabledModules($output);
68+
}
69+
70+
$onlyDisabled = $input->getOption('disabled');
71+
if ($onlyDisabled) {
72+
return $this->showDisabledModules($output);
73+
}
74+
75+
$output->writeln('<info>List of enabled modules:</info>');
76+
$this->showEnabledModules($output);
5877
$output->writeln('');
5978

60-
$fullModuleList = $this->objectManagerProvider->get()->create(\Magento\Framework\Module\FullModuleList::class);
6179
$output->writeln("<info>List of disabled modules:</info>");
62-
$disabledModules = array_diff($fullModuleList->getNames(), $enabledModules);
63-
if (count($disabledModules) === 0) {
80+
$this->showDisabledModules($output);
81+
$output->writeln('');
82+
}
83+
84+
/**
85+
* @param string $moduleName
86+
* @param OutputInterface $output
87+
*/
88+
private function showSpecificModule(string $moduleName, OutputInterface $output)
89+
{
90+
$allModules = $this->getAllModules();
91+
if (!in_array($moduleName, $allModules->getNames())) {
92+
$output->writeln('<error>Module does not exist</error>');
93+
return Cli::RETURN_FAILURE;
94+
}
95+
96+
$enabledModules = $this->getEnabledModules();
97+
if (in_array($moduleName, $enabledModules->getNames())) {
98+
$output->writeln('<info>Module is enabled</info>');
99+
return Cli::RETURN_FAILURE;
100+
}
101+
102+
$output->writeln('<info>Module is disabled</info>');
103+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
104+
}
105+
106+
/**
107+
* @param OutputInterface $output
108+
*/
109+
private function showEnabledModules(OutputInterface $output)
110+
{
111+
$enabledModules = $this->getEnabledModules();
112+
$enabledModuleNames = $enabledModules->getNames();
113+
if (count($enabledModuleNames) === 0) {
64114
$output->writeln('None');
65-
} else {
66-
$output->writeln(join("\n", $disabledModules));
115+
return Cli::RETURN_FAILURE;
67116
}
117+
118+
$output->writeln(join("\n", $enabledModuleNames));
68119
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
69120
}
121+
122+
/**
123+
* @param OutputInterface $output
124+
*/
125+
private function showDisabledModules(OutputInterface $output)
126+
{
127+
$disabledModuleNames = $this->getDisabledModuleNames();
128+
if (count($disabledModuleNames) === 0) {
129+
$output->writeln('None');
130+
return Cli::RETURN_FAILURE;
131+
}
132+
133+
$output->writeln(join("\n", $disabledModuleNames));
134+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
135+
}
136+
137+
/**
138+
* @return FullModuleList
139+
*/
140+
private function getAllModules(): FullModuleList
141+
{
142+
return $this->objectManagerProvider->get()->create(FullModuleList::class);
143+
}
144+
145+
/**
146+
* @return ModuleList
147+
*/
148+
private function getEnabledModules(): ModuleList
149+
{
150+
return $this->objectManagerProvider->get()->create(ModuleList::class);
151+
}
152+
153+
/**
154+
* @return array
155+
*/
156+
private function getDisabledModuleNames(): array
157+
{
158+
$fullModuleList = $this->getAllModules();
159+
$enabledModules = $this->getEnabledModules();
160+
return array_diff($fullModuleList->getNames(), $enabledModules->getNames());
161+
}
70162
}

0 commit comments

Comments
 (0)