Skip to content

Commit 79c4cd3

Browse files
authored
Merge branch '2.4-develop' into magento#39641
2 parents 80c0d08 + d550808 commit 79c4cd3

File tree

516 files changed

+24338
-9439
lines changed

Some content is hidden

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

516 files changed

+24338
-9439
lines changed

.github/app-projects-boards-automation.config.yaml

Lines changed: 402 additions & 0 deletions
Large diffs are not rendered by default.

app/code/Magento/AdvancedSearch/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The Magento_AdvancedSearch module introduces advanced search functionality and p
77
Before disabling or uninstalling this module, note that the following modules depends on this module:
88

99
- Magento_Elasticsearch
10-
- Magento_Elasticsearch7
10+
- Magento_Elasticsearch8
1111

1212
For information about module installation in Magento 2, see [Enable or disable modules](https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/tutorials/manage-modules.html).
1313

app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public function getFrontName($checkHost = false)
117117
/**
118118
* Return whether the host from request is the backend host
119119
*
120+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
121+
* @SuppressWarnings(PHPMD.NPathComplexity)
122+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
120123
* @return bool
121124
*/
122125
public function isHostBackend()
@@ -128,10 +131,11 @@ public function isHostBackend()
128131
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
129132
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
130133
} else {
131-
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
134+
$xmlPath = $this->request->isSecure() ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL;
135+
$backendUrl = $this->config->getValue($xmlPath);
132136
if ($backendUrl === null) {
133137
$backendUrl = $this->scopeConfig->getValue(
134-
Store::XML_PATH_UNSECURE_BASE_URL,
138+
$xmlPath,
135139
ScopeInterface::SCOPE_STORE
136140
);
137141
}

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
88

9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
911
/**
1012
* Backend grid item renderer currency
1113
*
@@ -82,7 +84,6 @@ public function render(\Magento\Framework\DataObject $row)
8284
{
8385
if ($data = (string)$this->_getValue($row)) {
8486
$currency_code = $this->_getCurrencyCode($row);
85-
$data = (float)$data * $this->_getRate($row);
8687
$sign = (bool)(int)$this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : '';
8788
$data = sprintf("%f", $data);
8889
$data = $this->_localeCurrency->getCurrency($currency_code)->toCurrency($data);
@@ -103,11 +104,28 @@ protected function _getCurrencyCode($row)
103104
return $code;
104105
}
105106
$currency = $this->getColumn()->getCurrency();
106-
107107
if ($currency !== null && $code = $row->getData($currency)) {
108108
return $code;
109109
}
110-
110+
$storeId = $row->getData('store_id');
111+
if ($storeId) {
112+
try {
113+
$store = $this->_storeManager->getStore($storeId);
114+
// Check if the currency is set at the store level
115+
$currencyCode = $store->getCurrentCurrencyCode();
116+
if ($currencyCode) {
117+
return $currencyCode;
118+
}
119+
$website = $store->getWebsite();
120+
// Check if the currency is set at the website level
121+
$currencyCode = $website->getBaseCurrencyCode();
122+
if ($currencyCode) {
123+
return $currencyCode;
124+
}
125+
} catch (NoSuchEntityException $e) {
126+
$this->_logger->warning('Failed to get website currency: ' . $e->getMessage());
127+
}
128+
}
111129
return $this->_currencyLocator->getDefaultCurrency($this->_request);
112130
}
113131

@@ -128,6 +146,17 @@ protected function _getRate($row)
128146
return (float) $rate;
129147
}
130148

149+
$storeId = $row->getData('store_id');
150+
if ($storeId) {
151+
try {
152+
$store = $this->_storeManager->getStore($storeId);
153+
return $store->getBaseCurrency()->getRate($store->getCurrentCurrencyCode());
154+
} catch (NoSuchEntityException $e) {
155+
$this->_logger->warning('Failed to get website currency: ' . $e->getMessage());
156+
}
157+
158+
}
159+
131160
return $this->_defaultBaseCurrency->getRate($this->_getCurrencyCode($row));
132161
}
133162

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Cron;
9+
10+
use Magento\Framework\Lock\Backend\FileLock;
11+
use Magento\Framework\Lock\LockBackendFactory;
12+
use Psr\Log\LoggerInterface;
13+
14+
class CleanLocks
15+
{
16+
/**
17+
* @param LockBackendFactory $lockFactory
18+
* @param LoggerInterface $logger
19+
*/
20+
public function __construct(
21+
private readonly LockBackendFactory $lockFactory,
22+
private readonly LoggerInterface $logger,
23+
) {
24+
}
25+
26+
/**
27+
* Cron job to cleanup old locks
28+
*/
29+
public function execute(): void
30+
{
31+
$locker = $this->lockFactory->create();
32+
33+
if ($locker instanceof FileLock) {
34+
$numberOfLockFilesDeleted = $locker->cleanupOldLocks();
35+
36+
$this->logger->info(sprintf('Deleted %d old lock files', $numberOfLockFilesDeleted));
37+
}
38+
}
39+
}

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -25,5 +25,7 @@
2525
<element name="noticeMessage" type="text" selector=".message-notice"/>
2626
<element name="assertCacheManagementConfigurationStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'CONFIG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
2727
<element name="assertCacheManagementLayoutsStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'LAYOUT_GENERAL_CACHE_TAG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
28+
<element name="assertCacheManagementStatusEnabled" type="button" selector="//td[@data-column='tags' and contains(text(),'{{cache}}')]/following-sibling::td//span[@class='grid-severity-notice']//span" parameterized="true"/>
29+
<element name="assertCacheManagementStatusInvalidated" type="button" selector="//td[@data-column='tags' and contains(text(),'{{cacheType}}')]/following-sibling::td//span[@class='grid-severity-minor']//span" parameterized="true"/>
2830
</section>
2931
</sections>

app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public function testIsHostBackend(
129129
->willReturnMap(
130130
[
131131
[Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
132+
[Store::XML_PATH_SECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
132133
[
133134
FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_URL,
134135
ScopeInterface::SCOPE_STORE,
@@ -160,7 +161,6 @@ public function testIsHostBackend(
160161
->setHost(parse_url($url, PHP_URL_HOST))
161162
->setPort(parse_url($url, PHP_URL_PORT))
162163
);
163-
164164
$this->assertEquals($expectedValue, $this->model->isHostBackend());
165165
}
166166

0 commit comments

Comments
 (0)