Skip to content

Commit f499027

Browse files
authored
Merge pull request #1 from magento/2.2-develop
Merged with last commits
2 parents b1cc3ea + ac1e74c commit f499027

File tree

1,678 files changed

+68655
-69866
lines changed

Some content is hidden

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

1,678 files changed

+68655
-69866
lines changed

.htaccess

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,15 @@
346346
Require all denied
347347
</IfVersion>
348348
</Files>
349+
<Files auth.json>
350+
<IfVersion < 2.4>
351+
order allow,deny
352+
deny from all
353+
</IfVersion>
354+
<IfVersion >= 2.4>
355+
Require all denied
356+
</IfVersion>
357+
</Files>
349358
<Files magento_umask>
350359
<IfVersion < 2.4>
351360
order allow,deny

.htaccess.sample

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,15 @@
323323
Require all denied
324324
</IfVersion>
325325
</Files>
326+
<Files auth.json>
327+
<IfVersion < 2.4>
328+
order allow,deny
329+
deny from all
330+
</IfVersion>
331+
<IfVersion >= 2.4>
332+
Require all denied
333+
</IfVersion>
334+
</Files>
326335
<Files magento_umask>
327336
<IfVersion < 2.4>
328337
order allow,deny

CHANGELOG.md

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

COPYING.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2013-2017 Magento, Inc.
1+
Copyright © 2013-present Magento, Inc.
22

33
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
44

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=develop)](https://travis-ci.org/magento/magento2)
1+
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.2-develop)](https://travis-ci.org/magento/magento2)
2+
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
23
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
34
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
45
<h2>Welcome</h2>
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
8-
[Magento system requirements](http://devdocs.magento.com/magento-system-requirements.html)
9+
[Magento system requirements](http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements2.html)
910

1011
## Install Magento
1112
To install Magento, see either:
1213

1314
* [Magento DevBox](https://magento.com/tech-resources/download), the easiest way to get started with Magento.
14-
* [Installation guide](http://devdocs.magento.com/guides/v2.0/install-gde/bk-install-guide.html)
15+
* [Installation guide](http://devdocs.magento.com/guides/v2.2/install-gde/bk-install-guide.html)
1516

1617
<h2>Contributing to the Magento 2 code base</h2>
1718
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.
@@ -22,8 +23,8 @@ To learn about issues, click [here][2]. To open an issue, click [here][3].
2223

2324
To suggest documentation improvements, click [here][4].
2425

25-
[1]: <http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html>
26-
[2]: <http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#report>
26+
[1]: <http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html>
27+
[2]: <http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#report>
2728
[3]: <https://github.com/magento/magento2/issues>
2829
[4]: <http://devdocs.magento.com>
2930

app/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
1515
if (PHP_SAPI == 'cli') {
1616
echo 'Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. ' .
17-
'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
17+
'Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html';
1818
} else {
1919
echo <<<HTML
2020
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
2121
<p>Magento supports PHP 7.0.2, 7.0.4, and 7.0.6 or later. Please read
22-
<a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
22+
<a target="_blank" href="http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html">
2323
Magento System Requirements</a>.
2424
</div>
2525
HTML;

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function execute()
3939
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
4040
}
4141
}
42-
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
42+
$this->_redirect('adminhtml/*/');
4343
}
4444
}

app/code/Magento/AdminNotification/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lib-libxml": "*"
1212
},
1313
"type": "magento2-module",
14-
"version": "100.2.0",
14+
"version": "100.2.1",
1515
"license": [
1616
"OSL-3.0",
1717
"AFL-3.0"

app/code/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabel.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,45 @@
55
*/
66
namespace Magento\Analytics\Block\Adminhtml\System\Config;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
/**
911
* Provides label with default Time Zone
1012
*/
1113
class CollectionTimeLabel extends \Magento\Config\Block\System\Config\Form\Field
1214
{
1315
/**
14-
* Add default time zone to comment
16+
* @var \Magento\Framework\Locale\ResolverInterface
17+
*/
18+
private $localeResolver;
19+
20+
/**
21+
* @param \Magento\Backend\Block\Template\Context $context
22+
* @param array $data
23+
* @param \Magento\Framework\Locale\ResolverInterface|null $localeResolver
24+
*/
25+
public function __construct(
26+
\Magento\Backend\Block\Template\Context $context,
27+
array $data = [],
28+
\Magento\Framework\Locale\ResolverInterface $localeResolver = null
29+
) {
30+
$this->localeResolver = $localeResolver ?:
31+
ObjectManager::getInstance()->get(\Magento\Framework\Locale\ResolverInterface::class);
32+
parent::__construct($context, $data);
33+
}
34+
35+
/**
36+
* Add current time zone to comment, properly translated according to locale
1537
*
1638
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
1739
* @return string
1840
*/
1941
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
2042
{
2143
$timeZoneCode = $this->_localeDate->getConfigTimezone();
22-
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName();
44+
$locale = $this->localeResolver->getLocale();
45+
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)
46+
->getDisplayName(false, \IntlTimeZone::DISPLAY_LONG, $locale);
2347
$element->setData(
2448
'comment',
2549
sprintf("%s (%s)", $getLongTimeZoneName, $timeZoneCode)

app/code/Magento/Analytics/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"require": {
55
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
66
"magento/module-backend": "100.2.*",
7-
"magento/module-config": "100.2.*",
7+
"magento/module-config": "101.0.*",
88
"magento/module-integration": "100.2.*",
99
"magento/module-store": "100.2.*",
10-
"magento/framework": "100.2.*"
10+
"magento/framework": "101.0.*"
1111
},
1212
"type": "magento2-module",
1313
"version": "100.2.0",

app/code/Magento/Backend/Block/Cache.php

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,29 @@ protected function _construct()
2222
$this->_headerText = __('Cache Storage Management');
2323
parent::_construct();
2424
$this->buttonList->remove('add');
25-
$this->buttonList->add(
26-
'flush_magento',
27-
[
28-
'label' => __('Flush Magento Cache'),
29-
'onclick' => 'setLocation(\'' . $this->getFlushSystemUrl() . '\')',
30-
'class' => 'primary flush-cache-magento'
31-
]
32-
);
3325

34-
$message = __('The cache storage may contain additional data. Are you sure that you want to flush it?');
35-
$this->buttonList->add(
36-
'flush_system',
37-
[
38-
'label' => __('Flush Cache Storage'),
39-
'onclick' => 'confirmSetLocation(\'' . $message . '\', \'' . $this->getFlushStorageUrl() . '\')',
40-
'class' => 'flush-cache-storage'
41-
]
42-
);
26+
if ($this->_authorization->isAllowed('Magento_Backend::flush_magento_cache')) {
27+
$this->buttonList->add(
28+
'flush_magento',
29+
[
30+
'label' => __('Flush Magento Cache'),
31+
'onclick' => 'setLocation(\'' . $this->getFlushSystemUrl() . '\')',
32+
'class' => 'primary flush-cache-magento'
33+
]
34+
);
35+
}
36+
37+
if ($this->_authorization->isAllowed('Magento_Backend::flush_cache_storage')) {
38+
$message = __('The cache storage may contain additional data. Are you sure that you want to flush it?');
39+
$this->buttonList->add(
40+
'flush_system',
41+
[
42+
'label' => __('Flush Cache Storage'),
43+
'onclick' => 'confirmSetLocation(\'' . $message . '\', \'' . $this->getFlushStorageUrl() . '\')',
44+
'class' => 'flush-cache-storage'
45+
]
46+
);
47+
}
4348
}
4449

4550
/**
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Block\Cache;
8+
9+
use Magento\Framework\AuthorizationInterface;
10+
use Magento\Framework\View\Element\Block\ArgumentInterface;
11+
12+
/**
13+
* Class Permissions
14+
*/
15+
class Permissions implements ArgumentInterface
16+
{
17+
/**
18+
* @var AuthorizationInterface
19+
*/
20+
private $authorization;
21+
22+
/**
23+
* Permissions constructor.
24+
*
25+
* @param AuthorizationInterface $authorization
26+
*/
27+
public function __construct(AuthorizationInterface $authorization)
28+
{
29+
$this->authorization = $authorization;
30+
}
31+
32+
/**
33+
* @return bool
34+
*/
35+
public function hasAccessToFlushCatalogImages()
36+
{
37+
return $this->authorization->isAllowed('Magento_Backend::flush_catalog_images');
38+
}
39+
/**
40+
* @return bool
41+
*/
42+
public function hasAccessToFlushJsCss()
43+
{
44+
return $this->authorization->isAllowed('Magento_Backend::flush_js_css');
45+
}
46+
/**
47+
* @return bool
48+
*/
49+
public function hasAccessToFlushStaticFiles()
50+
{
51+
return $this->authorization->isAllowed('Magento_Backend::flush_static_files');
52+
}
53+
/**
54+
* @return bool
55+
*/
56+
public function hasAccessToAdditionalActions()
57+
{
58+
return ($this->hasAccessToFlushCatalogImages()
59+
|| $this->hasAccessToFlushJsCss()
60+
|| $this->hasAccessToFlushStaticFiles());
61+
}
62+
}

app/code/Magento/Backend/Block/GlobalSearch.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,61 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Backend\Block;
78

9+
use Magento\Backend\Model\GlobalSearch\SearchEntityFactory;
10+
use Magento\Backend\Model\GlobalSearch\SearchEntity;
11+
use Magento\Framework\App\ObjectManager;
12+
813
/**
914
* @api
1015
* @since 100.0.2
1116
*/
1217
class GlobalSearch extends \Magento\Backend\Block\Template
1318
{
19+
/**
20+
* @var SearchEntityFactory
21+
*/
22+
private $searchEntityFactory;
23+
1424
/**
1525
* @var string
1626
*/
1727
protected $_template = 'Magento_Backend::system/search.phtml';
1828

29+
/**
30+
* @var array
31+
*/
32+
private $entityResources;
33+
34+
/**
35+
* @var array
36+
*/
37+
private $entityPaths;
38+
39+
/**
40+
* @param Template\Context $context
41+
* @param array $data
42+
* @param array $entityResources
43+
* @param array $entityPaths
44+
* @param SearchEntityFactory|null $searchEntityFactory
45+
*/
46+
public function __construct(
47+
Template\Context $context,
48+
array $data = [],
49+
array $entityResources = [],
50+
array $entityPaths = [],
51+
SearchEntityFactory $searchEntityFactory = null
52+
) {
53+
$this->entityResources = $entityResources;
54+
$this->entityPaths = $entityPaths;
55+
$this->searchEntityFactory = $searchEntityFactory ?: ObjectManager::getInstance()
56+
->get(SearchEntityFactory::class);
57+
58+
parent::__construct($context, $data);
59+
}
60+
1961
/**
2062
* Get components configuration
2163
* @return array
@@ -34,4 +76,48 @@ public function getWidgetInitOptions()
3476
]
3577
];
3678
}
79+
80+
/**
81+
* Get entities which are allowed to show.
82+
*
83+
* @return SearchEntity[]
84+
*/
85+
public function getEntitiesToShow()
86+
{
87+
$allowedEntityTypes = [];
88+
$entitiesToShow = [];
89+
90+
foreach ($this->entityResources as $entityType => $resource) {
91+
if ($this->getAuthorization()->isAllowed($resource)) {
92+
$allowedEntityTypes[] = $entityType;
93+
}
94+
}
95+
96+
foreach ($allowedEntityTypes as $entityType) {
97+
$url = $this->getUrlEntityType($entityType);
98+
99+
$searchEntity = $this->searchEntityFactory->create();
100+
$searchEntity->setId('searchPreview' . $entityType);
101+
$searchEntity->setTitle('in ' . $entityType);
102+
$searchEntity->setUrl($url);
103+
104+
$entitiesToShow[] = $searchEntity;
105+
}
106+
107+
return $entitiesToShow;
108+
}
109+
110+
/**
111+
* Get url path by entity type.
112+
*
113+
* @param string $entityType
114+
*
115+
* @return string
116+
*/
117+
private function getUrlEntityType(string $entityType)
118+
{
119+
$urlPath = $this->entityPaths[$entityType] ?? '';
120+
121+
return $this->getUrl($urlPath);
122+
}
37123
}

0 commit comments

Comments
 (0)