Skip to content

Commit 2f5ff1a

Browse files
authored
Merge branch '2.4-develop' into fix-31043
2 parents b8f1e4c + 647b34e commit 2f5ff1a

File tree

13 files changed

+187
-85
lines changed

13 files changed

+187
-85
lines changed

app/code/Magento/Bundle/Model/Plugin/PriceBackend.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<?php
2+
23
/**
34
* Copyright © Magento, Inc. All rights reserved.
45
* See COPYING.txt for license details.
56
*/
7+
declare(strict_types=1);
8+
69
namespace Magento\Bundle\Model\Plugin;
710

811
/**
9-
* Class PriceBackend
10-
*
11-
* Make price validation optional for bundle dynamic
12+
* Make price validation optional for bundle dynamic
1213
*/
1314
class PriceBackend
1415
{
1516
/**
17+
* Around validate
18+
*
1619
* @param \Magento\Catalog\Model\Product\Attribute\Backend\Price $subject
1720
* @param \Closure $proceed
1821
* @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $object
@@ -30,6 +33,7 @@ public function aroundValidate(
3033
) {
3134
return true;
3235
}
36+
3337
return $proceed($object);
3438
}
3539
}

app/code/Magento/ConfigurableProduct/Model/Plugin/PriceBackend.php

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

10+
use Magento\Catalog\Api\Data\ProductInterface;
811
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
912

1013
/**
11-
* Class PriceBackend
12-
*
13-
* Make price validation optional for configurable product
14+
* Make price validation optional for configurable product
1415
*/
1516
class PriceBackend
1617
{
1718
/**
19+
* Around validate
20+
*
1821
* @param \Magento\Catalog\Model\Product\Attribute\Backend\Price $subject
1922
* @param \Closure $proceed
2023
* @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $object
@@ -26,12 +29,10 @@ public function aroundValidate(
2629
\Closure $proceed,
2730
$object
2831
) {
29-
if ($object instanceof \Magento\Catalog\Model\Product
30-
&& $object->getTypeId() == Configurable::TYPE_CODE
31-
) {
32+
if ($object instanceof ProductInterface && $object->getTypeId() === Configurable::TYPE_CODE) {
3233
return true;
33-
} else {
34-
return $proceed($object);
3534
}
35+
36+
return $proceed($object);
3637
}
3738
}

app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace Magento\Cron\Observer;
1111

12+
use Laminas\Http\PhpEnvironment\Request as Environment;
1213
use Exception;
1314
use Magento\Cron\Model\DeadlockRetrierInterface;
1415
use Magento\Cron\Model\ResourceModel\Schedule\Collection as ScheduleCollection;
@@ -133,6 +134,16 @@ class ProcessCronQueueObserver implements ObserverInterface
133134
*/
134135
protected $dateTime;
135136

137+
/**
138+
* @var Environment
139+
*/
140+
private Environment $environment;
141+
142+
/**
143+
* @var string
144+
*/
145+
private string $originalProcessTitle;
146+
136147
/**
137148
* @var \Symfony\Component\Process\PhpExecutableFinder
138149
*/
@@ -189,6 +200,7 @@ class ProcessCronQueueObserver implements ObserverInterface
189200
* @param \Magento\Framework\Lock\LockManagerInterface $lockManager
190201
* @param \Magento\Framework\Event\ManagerInterface $eventManager
191202
* @param DeadlockRetrierInterface $retrier
203+
* @param Environment $environment
192204
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
193205
*/
194206
public function __construct(
@@ -206,7 +218,8 @@ public function __construct(
206218
StatFactory $statFactory,
207219
\Magento\Framework\Lock\LockManagerInterface $lockManager,
208220
\Magento\Framework\Event\ManagerInterface $eventManager,
209-
DeadlockRetrierInterface $retrier
221+
DeadlockRetrierInterface $retrier,
222+
Environment $environment
210223
) {
211224
$this->_objectManager = $objectManager;
212225
$this->_scheduleFactory = $scheduleFactory;
@@ -216,6 +229,7 @@ public function __construct(
216229
$this->_request = $request;
217230
$this->_shell = $shell;
218231
$this->dateTime = $dateTime;
232+
$this->environment = $environment;
219233
$this->phpExecutableFinder = $phpExecutableFinderFactory->create();
220234
$this->logger = $logger;
221235
$this->state = $state;
@@ -354,6 +368,8 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule,
354368
);
355369
}
356370

371+
$this->setProcessTitle($jobCode, $groupId);
372+
357373
$schedule->setExecutedAt(date('Y-m-d H:i:s', $this->dateTime->gmtTimestamp()));
358374
$this->retrier->execute(
359375
function () use ($schedule) {
@@ -944,4 +960,24 @@ function () use ($scheduleResource, $where) {
944960
$scheduleResource->getConnection()
945961
);
946962
}
963+
964+
/**
965+
* Set the process title to include the job code and group
966+
*
967+
* @param string $jobCode
968+
* @param string $groupId
969+
*/
970+
private function setProcessTitle(string $jobCode, string $groupId): void
971+
{
972+
if (!isset($this->originalProcessTitle)) {
973+
$this->originalProcessTitle = PHP_BINARY . ' ' . implode(' ', $this->environment->getServer('argv'));
974+
}
975+
976+
if (strpos($this->originalProcessTitle, " --group=$groupId ") !== false) {
977+
// Group is already shown, so no need to include here in duplicate
978+
cli_set_process_title($this->originalProcessTitle . " # job: $jobCode");
979+
} else {
980+
cli_set_process_title($this->originalProcessTitle . " # group: $groupId, job: $jobCode");
981+
}
982+
}
947983
}

app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Cron\Test\Unit\Observer;
99

1010
use Exception;
11+
use Laminas\Http\PhpEnvironment\Request as Environment;
1112
use Magento\Cron\Model\Config;
1213
use Magento\Cron\Model\DeadlockRetrierInterface;
1314
use Magento\Cron\Model\ResourceModel\Schedule as ScheduleResourceModel;
@@ -20,8 +21,8 @@
2021
use Magento\Framework\App\Config\ScopeConfigInterface;
2122
use Magento\Framework\App\Console\Request as ConsoleRequest;
2223
use Magento\Framework\App\ObjectManager;
23-
use Magento\Framework\App\State;
2424
use Magento\Framework\App\State as AppState;
25+
use Magento\Framework\App\State;
2526
use Magento\Framework\DataObject;
2627
use Magento\Framework\DB\Adapter\AdapterInterface;
2728
use Magento\Framework\Event\ManagerInterface;
@@ -219,6 +220,14 @@ protected function setUp(): void
219220

220221
$this->retrierMock = $this->getMockForAbstractClass(DeadlockRetrierInterface::class);
221222

223+
$environmentMock = $this->getMockBuilder(Environment::class)
224+
->disableOriginalConstructor()
225+
->getMock();
226+
$environmentMock->expects($this->any())
227+
->method('getServer')
228+
->with('argv')
229+
->willReturn([]);
230+
222231
$this->cronQueueObserver = new ProcessCronQueueObserver(
223232
$this->objectManagerMock,
224233
$this->scheduleFactoryMock,
@@ -234,7 +243,8 @@ protected function setUp(): void
234243
$this->statFactory,
235244
$this->lockManagerMock,
236245
$this->eventManager,
237-
$this->retrierMock
246+
$this->retrierMock,
247+
$environmentMock
238248
);
239249
}
240250

app/code/Magento/Store/Model/Store.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Framework\Url\ScopeInterface as UrlScopeInterface;
2222
use Magento\Framework\UrlInterface;
2323
use Magento\Store\Api\Data\StoreInterface;
24+
use Magento\Store\Model\StoreManager;
2425

2526
/**
2627
* Store model
@@ -760,6 +761,7 @@ protected function _updatePathUseStoreView($url)
760761
public function isUseStoreInUrl()
761762
{
762763
return !($this->hasDisableStoreInUrl() && $this->getDisableStoreInUrl())
764+
&& !$this->getConfig(StoreManager::XML_PATH_SINGLE_STORE_MODE_ENABLED)
763765
&& $this->getConfig(self::XML_PATH_STORE_IN_URL);
764766
}
765767

app/code/Magento/Store/Url/Plugin/SecurityInfo.php

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

8-
use \Magento\Store\Model\Store;
9-
use \Magento\Store\Model\ScopeInterface as StoreScopeInterface;
10+
use Magento\Store\Model\ScopeInterface as StoreScopeInterface;
11+
use Magento\Store\Model\Store;
1012

1113
/**
1214
* Plugin for \Magento\Framework\Url\SecurityInfo
@@ -39,8 +41,8 @@ public function aroundIsSecure(\Magento\Framework\Url\SecurityInfo $subject, \Cl
3941
{
4042
if ($this->scopeConfig->getValue(Store::XML_PATH_SECURE_IN_FRONTEND, StoreScopeInterface::SCOPE_STORE)) {
4143
return $proceed($url);
42-
} else {
43-
return false;
4444
}
45+
46+
return false;
4547
}
4648
}

0 commit comments

Comments
 (0)