Skip to content

Commit 8f5f9a5

Browse files
authored
Merge branch '2.4-develop' into fix/issue-24735
2 parents c7deb42 + b0f9505 commit 8f5f9a5

File tree

3,112 files changed

+102373
-18522
lines changed

Some content is hidden

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

3,112 files changed

+102373
-18522
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Fields marked with (*) are required. Please don't remove the template.
1111

1212
### Preconditions (*)
1313
<!---
14-
Provide the exact Magento version (example: 2.2.5) and any important information on the environment where bug is reproducible.
14+
Provide the exact Magento version (example: 2.3.2) and any important information on the environment where bug is reproducible.
1515
-->
1616
1.
1717
2.

CHANGELOG.md

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

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
22
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
33
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.svg)](https://crowdin.com/project/magento-2)
4-
<h2>Welcome</h2>
4+
5+
## Welcome
56
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.
67

78
## Magento System Requirements
89
[Magento System Requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements.html).
910

1011
## Install Magento
1112

12-
* [Installation Guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
13+
* [Installation Guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
1314

1415
## Learn More About GraphQL in Magento 2
1516

@@ -18,7 +19,7 @@ Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a
1819
<h2>Contributing to the Magento 2 Code Base</h2>
1920
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
2021

21-
To learn about how to make a contribution, click [here][1].
22+
To learn about how to contribute, click [here][1].
2223

2324
To learn about issues, click [here][2]. To open an issue, click [here][3].
2425

@@ -30,14 +31,14 @@ To suggest documentation improvements, click [here][4].
3031
[4]: https://devdocs.magento.com
3132

3233
<h3>Community Maintainers</h3>
33-
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks these Community Maintainers for their valuable contributions.
34+
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks to these Community Maintainers for their valuable contributions.
3435

3536
<a href="https://magento.com/magento-contributors#maintainers">
3637
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/maintainers.png"/>
3738
</a>
3839

3940
<h3>Top Contributors</h3>
40-
Magento is thankful for any contribution that can improve our code base, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
41+
Magento is thankful for any contribution that can improve our codebase, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
4142
<a href="https://magento.com/magento-contributors">
4243
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/contributors.png"/>
4344
</a>
@@ -48,7 +49,7 @@ Please review the [Code Contributions guide](https://devdocs.magento.com/guides/
4849

4950
## Reporting Security Issues
5051

51-
To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up your issue.
52+
To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up on your issue.
5253

5354
Stay up-to-date on the latest security news and patches for Magento by signing up for [Security Alert Notifications](https://magento.com/security/sign-up).
5455

@@ -64,7 +65,7 @@ Please see LICENSE_EE.txt for the full text of the MEE License or visit https://
6465

6566
## Community Engineering Slack
6667

67-
To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us request at [[email protected]](mailto:[email protected]) or [self signup](https://tinyurl.com/engcom-slack).
68+
To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us a request at [[email protected]](mailto:[email protected]) or [self signup](https://opensource.magento.com/slack).
6869

6970

7071
We have channels for each project. These channels are recommended for new members:
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AdminAnalytics\Controller\Adminhtml\Config;
9+
10+
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
12+
use Magento\Framework\Controller\ResultFactory;
13+
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
14+
use Magento\Framework\App\ProductMetadataInterface;
15+
use Magento\Framework\Controller\ResultInterface;
16+
use Magento\Config\Model\Config\Factory;
17+
18+
/**
19+
* Controller to record Admin analytics usage log
20+
*/
21+
class DisableAdminUsage extends Action implements HttpPostActionInterface
22+
{
23+
/**
24+
* @var Factory
25+
*/
26+
private $configFactory;
27+
28+
/**
29+
* @var ProductMetadataInterface
30+
*/
31+
private $productMetadata;
32+
33+
/**
34+
* @var NotificationLogger
35+
*/
36+
private $notificationLogger;
37+
38+
/**
39+
* DisableAdminUsage constructor.
40+
*
41+
* @param Action\Context $context
42+
* @param ProductMetadataInterface $productMetadata
43+
* @param NotificationLogger $notificationLogger
44+
* @param Factory $configFactory
45+
*/
46+
public function __construct(
47+
Action\Context $context,
48+
ProductMetadataInterface $productMetadata,
49+
NotificationLogger $notificationLogger,
50+
Factory $configFactory
51+
) {
52+
parent::__construct($context);
53+
$this->configFactory = $configFactory;
54+
$this->productMetadata = $productMetadata;
55+
$this->notificationLogger = $notificationLogger;
56+
}
57+
58+
/**
59+
* Change the value of config/admin/usage/enabled
60+
*/
61+
private function disableAdminUsage()
62+
{
63+
$configModel = $this->configFactory->create();
64+
$configModel->setDataByPath('admin/usage/enabled', 0);
65+
$configModel->save();
66+
}
67+
68+
/**
69+
* Log information about the last admin usage selection
70+
*
71+
* @return ResultInterface
72+
*/
73+
private function markUserNotified(): ResultInterface
74+
{
75+
$responseContent = [
76+
'success' => $this->notificationLogger->log(
77+
$this->productMetadata->getVersion()
78+
),
79+
'error_message' => ''
80+
];
81+
82+
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
83+
return $resultJson->setData($responseContent);
84+
}
85+
86+
/**
87+
* Log information about the last shown advertisement
88+
*
89+
* @return ResultInterface
90+
*/
91+
public function execute()
92+
{
93+
$this->disableAdminUsage();
94+
$this->markUserNotified();
95+
}
96+
97+
/**
98+
* @inheritDoc
99+
*/
100+
protected function _isAllowed()
101+
{
102+
return $this->_authorization->isAllowed(static::ADMIN_RESOURCE);
103+
}
104+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AdminAnalytics\Controller\Adminhtml\Config;
9+
10+
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
12+
use Magento\Framework\Controller\ResultFactory;
13+
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
14+
use Magento\Framework\App\ProductMetadataInterface;
15+
use Magento\Framework\Controller\ResultInterface;
16+
use Magento\Config\Model\Config\Factory;
17+
18+
/**
19+
* Controller to record that the current admin user has responded to Admin Analytics notice
20+
*/
21+
class EnableAdminUsage extends Action implements HttpPostActionInterface
22+
{
23+
/**
24+
* @var Factory
25+
*/
26+
private $configFactory;
27+
28+
/**
29+
* @var ProductMetadataInterface
30+
*/
31+
private $productMetadata;
32+
33+
/**
34+
* @var NotificationLogger
35+
*/
36+
private $notificationLogger;
37+
38+
/**
39+
* @param Action\Context $context
40+
* @param ProductMetadataInterface $productMetadata
41+
* @param NotificationLogger $notificationLogger
42+
* @param Factory $configFactory
43+
*/
44+
public function __construct(
45+
Action\Context $context,
46+
ProductMetadataInterface $productMetadata,
47+
NotificationLogger $notificationLogger,
48+
Factory $configFactory
49+
) {
50+
parent::__construct($context);
51+
$this->configFactory = $configFactory;
52+
$this->productMetadata = $productMetadata;
53+
$this->notificationLogger = $notificationLogger;
54+
}
55+
56+
/**
57+
* Change the value of config/admin/usage/enabled
58+
*/
59+
private function enableAdminUsage()
60+
{
61+
$configModel = $this->configFactory->create();
62+
$configModel->setDataByPath('admin/usage/enabled', 1);
63+
$configModel->save();
64+
}
65+
66+
/**
67+
* Log information about the last user response
68+
*
69+
* @return ResultInterface
70+
*/
71+
private function markUserNotified(): ResultInterface
72+
{
73+
$responseContent = [
74+
'success' => $this->notificationLogger->log(
75+
$this->productMetadata->getVersion()
76+
),
77+
'error_message' => ''
78+
];
79+
80+
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
81+
return $resultJson->setData($responseContent);
82+
}
83+
84+
/**
85+
* Log information about the last shown advertisement
86+
*
87+
* @return \Magento\Framework\Controller\ResultInterface
88+
*/
89+
public function execute()
90+
{
91+
$this->enableAdminUsage();
92+
$this->markUserNotified();
93+
}
94+
95+
/**
96+
* @inheritDoc
97+
*/
98+
protected function _isAllowed()
99+
{
100+
return $this->_authorization->isAllowed(static::ADMIN_RESOURCE);
101+
}
102+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AdminAnalytics\Model\Condition;
9+
10+
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger;
11+
use Magento\Framework\View\Layout\Condition\VisibilityConditionInterface;
12+
use Magento\Framework\App\CacheInterface;
13+
14+
/**
15+
* Dynamic validator for UI admin analytics notification, control UI component visibility.
16+
*/
17+
class CanViewNotification implements VisibilityConditionInterface
18+
{
19+
/**
20+
* Unique condition name.
21+
*
22+
* @var string
23+
*/
24+
private static $conditionName = 'can_view_admin_usage_notification';
25+
26+
/**
27+
* Prefix for cache
28+
*
29+
* @var string
30+
*/
31+
private static $cachePrefix = 'admin-usage-notification-popup';
32+
33+
/**
34+
* @var Logger
35+
*/
36+
private $viewerLogger;
37+
38+
/**
39+
* @var CacheInterface
40+
*/
41+
private $cacheStorage;
42+
43+
/**
44+
* @param Logger $viewerLogger
45+
* @param CacheInterface $cacheStorage
46+
*/
47+
public function __construct(
48+
Logger $viewerLogger,
49+
CacheInterface $cacheStorage
50+
) {
51+
$this->viewerLogger = $viewerLogger;
52+
$this->cacheStorage = $cacheStorage;
53+
}
54+
55+
/**
56+
* Validate if notification popup can be shown and set the notification flag
57+
*
58+
* @param array $arguments Attributes from element node.
59+
* @inheritdoc
60+
*/
61+
public function isVisible(array $arguments): bool
62+
{
63+
$cacheKey = self::$cachePrefix;
64+
$value = $this->cacheStorage->load($cacheKey);
65+
if ($value !== 'log-exists') {
66+
$logExists = $this->viewerLogger->checkLogExists();
67+
if ($logExists) {
68+
$this->cacheStorage->save('log-exists', $cacheKey);
69+
}
70+
return !$logExists;
71+
}
72+
return false;
73+
}
74+
75+
/**
76+
* Get condition name
77+
*
78+
* @return string
79+
*/
80+
public function getName(): string
81+
{
82+
return self::$conditionName;
83+
}
84+
}

0 commit comments

Comments
 (0)