Skip to content

Commit 4bbc07d

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents d75589f + 19c196e commit 4bbc07d

File tree

99 files changed

+1933
-2834
lines changed

Some content is hidden

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

99 files changed

+1933
-2834
lines changed

app/code/Magento/CatalogGraphQl/Model/Category/DepthCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function calculate(FieldNode $fieldNode) : int
2626
$depth = count($selections) ? 1 : 0;
2727
$childrenDepth = [0];
2828
foreach ($selections as $node) {
29-
if ($node->kind === 'InlineFragment') {
29+
if ($node->kind === 'InlineFragment' || null !== $node->alias) {
3030
continue;
3131
}
3232

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ input ProductFilterInput @doc(description: "ProductFilterInput defines the filte
460460
description: FilterTypeInput @doc(description: "Detailed information about the product. The value can include simple HTML tags.")
461461
short_description: FilterTypeInput @doc(description: "A short description of the product. Its use depends on the theme.")
462462
price: FilterTypeInput @doc(description: "The price of an item")
463-
special_price: FilterTypeInput @doc(description: "The discounted price of the product")
463+
special_price: FilterTypeInput @doc(description: "The discounted price of the product. Do not include the currency code.")
464464
special_from_date: FilterTypeInput @doc(description: "The beginning date that a product has a special price")
465465
special_to_date: FilterTypeInput @doc(description: "The end date that a product has a special price")
466466
weight: FilterTypeInput @doc(description: "The weight of the item, in units defined by the store")
@@ -477,7 +477,6 @@ input ProductFilterInput @doc(description: "ProductFilterInput defines the filte
477477
custom_layout_update: FilterTypeInput @doc(description: "XML code that is applied as a layout update to the product page")
478478
min_price: FilterTypeInput @doc(description:"The numeric minimal price of the product. Do not include the currency code.")
479479
max_price: FilterTypeInput @doc(description:"The numeric maximal price of the product. Do not include the currency code.")
480-
special_price: FilterTypeInput @doc(description:"The numeric special price of the product. Do not include the currency code.")
481480
category_id: FilterTypeInput @doc(description: "Category ID the product belongs to")
482481
options_container: FilterTypeInput @doc(description: "If the product has multiple options, determines where they appear on the product page")
483482
required_options: FilterTypeInput @doc(description: "Indicates whether the product has required options")

app/code/Magento/Config/Observer/Config/Backend/Admin/AfterCustomUrlChangedObserver.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Config\Observer\Config\Backend\Admin;
79

810
use Magento\Framework\Event\ObserverInterface;
911

12+
/**
13+
* Class AfterCustomUrlChangedObserver redirects to new custom admin URL.
14+
*
15+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
16+
*/
1017
class AfterCustomUrlChangedObserver implements ObserverInterface
1118
{
1219
/**
@@ -56,7 +63,6 @@ public function __construct(
5663
*
5764
* @param \Magento\Framework\Event\Observer $observer
5865
* @return void
59-
* @SuppressWarnings(PHPMD.ExitExpression)
6066
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6167
*/
6268
public function execute(\Magento\Framework\Event\Observer $observer)
@@ -68,6 +74,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6874
$this->_authSession->destroy();
6975
$adminUrl = $this->_backendData->getHomePageUrl();
7076
$this->_response->setRedirect($adminUrl)->sendResponse();
77+
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
7178
exit(0);
7279
}
7380
}

app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Customer\Controller\Adminhtml\Index;
79

810
use Magento\Customer\Api\AccountManagementInterface;
@@ -17,7 +19,10 @@
1719
use Magento\Framework\DataObjectFactory;
1820

1921
/**
22+
* Class Viewfile serves to show file or image by file/image name provided in request parameters.
23+
*
2024
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
25+
* @SuppressWarnings(PHPMD.AllPurposeAction)
2126
*/
2227
class Viewfile extends \Magento\Customer\Controller\Adminhtml\Index
2328
{
@@ -127,8 +132,6 @@ public function __construct(
127132
*
128133
* @return \Magento\Framework\Controller\ResultInterface|void
129134
* @throws NotFoundException
130-
*
131-
* @SuppressWarnings(PHPMD.ExitExpression)
132135
*/
133136
public function execute()
134137
{
@@ -146,6 +149,7 @@ public function execute()
146149
}
147150

148151
if ($plain) {
152+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
149153
$extension = pathinfo($path, PATHINFO_EXTENSION);
150154
switch (strtolower($extension)) {
151155
case 'gif':
@@ -175,6 +179,7 @@ public function execute()
175179
$resultRaw->setContents($directory->readFile($fileName));
176180
return $resultRaw;
177181
} else {
182+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
178183
$name = pathinfo($path, PATHINFO_BASENAME);
179184
$this->_fileFactory->create(
180185
$name,

app/code/Magento/Deploy/Process/Queue.php

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Deploy\Process;
79

810
use Magento\Deploy\Package\Package;
@@ -125,6 +127,8 @@ public function __construct(
125127
}
126128

127129
/**
130+
* Adds deployment package.
131+
*
128132
* @param Package $package
129133
* @param Package[] $dependencies
130134
* @return bool true on success
@@ -140,6 +144,8 @@ public function add(Package $package, array $dependencies = [])
140144
}
141145

142146
/**
147+
* Returns packages array.
148+
*
143149
* @return Package[]
144150
*/
145151
public function getPackages()
@@ -162,6 +168,7 @@ public function process()
162168
$this->assertAndExecute($name, $packages, $packageJob);
163169
}
164170
$this->logger->info('.');
171+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
165172
sleep(3);
166173
foreach ($this->inProgress as $name => $package) {
167174
if ($this->isDeployed($package)) {
@@ -209,6 +216,8 @@ private function assertAndExecute($name, array & $packages, array $packageJob)
209216
}
210217

211218
/**
219+
* Executes deployment package.
220+
*
212221
* @param Package $package
213222
* @param string $name
214223
* @param array $packages
@@ -244,6 +253,7 @@ private function awaitForAllProcesses()
244253
}
245254
}
246255
$this->logger->info('.');
256+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
247257
sleep(5);
248258
}
249259
if ($this->isCanBeParalleled()) {
@@ -253,6 +263,8 @@ private function awaitForAllProcesses()
253263
}
254264

255265
/**
266+
* Checks if can be parallel.
267+
*
256268
* @return bool
257269
*/
258270
private function isCanBeParalleled()
@@ -261,9 +273,11 @@ private function isCanBeParalleled()
261273
}
262274

263275
/**
276+
* Executes the process.
277+
*
264278
* @param Package $package
265279
* @return bool true on success for main process and exit for child process
266-
* @SuppressWarnings(PHPMD.ExitExpression)
280+
* @throws \RuntimeException
267281
*/
268282
private function execute(Package $package)
269283
{
@@ -291,6 +305,7 @@ function () use ($package) {
291305
);
292306

293307
if ($this->isCanBeParalleled()) {
308+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
294309
$pid = pcntl_fork();
295310
if ($pid === -1) {
296311
throw new \RuntimeException('Unable to fork a new process');
@@ -305,6 +320,7 @@ function () use ($package) {
305320
// process child process
306321
$this->inProgress = [];
307322
$this->deployPackageService->deploy($package, $this->options, true);
323+
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
308324
exit(0);
309325
} else {
310326
$this->deployPackageService->deploy($package, $this->options);
@@ -313,18 +329,22 @@ function () use ($package) {
313329
}
314330

315331
/**
332+
* Checks if package is deployed.
333+
*
316334
* @param Package $package
317335
* @return bool
318336
*/
319337
private function isDeployed(Package $package)
320338
{
321339
if ($this->isCanBeParalleled()) {
322340
if ($package->getState() === null) {
341+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
323342
$pid = pcntl_waitpid($this->getPid($package), $status, WNOHANG);
324343
if ($pid === $this->getPid($package)) {
325344
$package->setState(Package::STATE_COMPLETED);
326345

327346
unset($this->inProgress[$package->getPath()]);
347+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
328348
return pcntl_wexitstatus($status) === 0;
329349
}
330350
return false;
@@ -334,17 +354,19 @@ private function isDeployed(Package $package)
334354
}
335355

336356
/**
357+
* Returns process ID or null if not found.
358+
*
337359
* @param Package $package
338360
* @return int|null
339361
*/
340362
private function getPid(Package $package)
341363
{
342-
return isset($this->processIds[$package->getPath()])
343-
? $this->processIds[$package->getPath()]
344-
: null;
364+
return isset($this->processIds[$package->getPath()]) ?? null;
345365
}
346366

347367
/**
368+
* Checks timeout.
369+
*
348370
* @return bool
349371
*/
350372
private function checkTimeout()
@@ -357,11 +379,13 @@ private function checkTimeout()
357379
*
358380
* Protect against zombie process
359381
*
382+
* @throws \RuntimeException
360383
* @return void
361384
*/
362385
public function __destruct()
363386
{
364387
foreach ($this->inProgress as $package) {
388+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
365389
if (pcntl_waitpid($this->getPid($package), $status) === -1) {
366390
throw new \RuntimeException(
367391
'Error while waiting for package deployed: ' . $this->getPid($package) . '; Status: ' . $status

app/code/Magento/Downloadable/Controller/Download/Link.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
6+
declare(strict_types=1);
7+
78
namespace Magento\Downloadable\Controller\Download;
89

910
use Magento\Downloadable\Helper\Download as DownloadHelper;
1011
use Magento\Downloadable\Model\Link\Purchased\Item as PurchasedLink;
1112
use Magento\Framework\App\ResponseInterface;
1213

14+
/**
15+
* Class Link executes download link action.
16+
*
17+
* @SuppressWarnings(PHPMD.AllPurposeAction)
18+
*/
1319
class Link extends \Magento\Downloadable\Controller\Download
1420
{
1521
/**
@@ -29,7 +35,6 @@ protected function _getCustomerSession()
2935
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
3036
* @SuppressWarnings(PHPMD.NPathComplexity)
3137
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
32-
* @SuppressWarnings(PHPMD.ExitExpression)
3338
*/
3439
public function execute()
3540
{
@@ -117,6 +122,7 @@ public function execute()
117122
$linkPurchasedItem->setStatus(PurchasedLink::LINK_STATUS_EXPIRED);
118123
}
119124
$linkPurchasedItem->save();
125+
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
120126
exit(0);
121127
} catch (\Exception $e) {
122128
$this->messageManager->addError(__('Something went wrong while getting the requested content.'));

app/code/Magento/Downloadable/Controller/Download/LinkSample.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
6+
declare(strict_types=1);
7+
78
namespace Magento\Downloadable\Controller\Download;
89

910
use Magento\Downloadable\Helper\Download as DownloadHelper;
1011
use Magento\Framework\App\ResponseInterface;
1112

13+
/**
14+
* Class LinkSample executes download sample link action.
15+
*
16+
* @SuppressWarnings(PHPMD.AllPurposeAction)
17+
*/
1218
class LinkSample extends \Magento\Downloadable\Controller\Download
1319
{
1420
/**
1521
* Download link's sample action
1622
*
1723
* @return ResponseInterface
18-
* @SuppressWarnings(PHPMD.ExitExpression)
1924
*/
2025
public function execute()
2126
{
@@ -39,6 +44,7 @@ public function execute()
3944
}
4045
try {
4146
$this->_processDownload($resource, $resourceType);
47+
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
4248
exit(0);
4349
} catch (\Exception $e) {
4450
$this->messageManager->addError(

app/code/Magento/Downloadable/Controller/Download/Sample.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
6+
declare(strict_types=1);
7+
78
namespace Magento\Downloadable\Controller\Download;
89

910
use Magento\Downloadable\Helper\Download as DownloadHelper;
1011
use Magento\Framework\App\ResponseInterface;
1112

13+
/**
14+
* Class Sample executes download sample action.
15+
*
16+
* @SuppressWarnings(PHPMD.AllPurposeAction)
17+
*/
1218
class Sample extends \Magento\Downloadable\Controller\Download
1319
{
1420
/**
1521
* Download sample action
1622
*
1723
* @return ResponseInterface
18-
* @SuppressWarnings(PHPMD.ExitExpression)
1924
*/
2025
public function execute()
2126
{
@@ -36,6 +41,7 @@ public function execute()
3641
}
3742
try {
3843
$this->_processDownload($resource, $resourceType);
44+
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
3945
exit(0);
4046
} catch (\Exception $e) {
4147
$this->messageManager->addError(

0 commit comments

Comments
 (0)