Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit a63a3b5

Browse files
committed
Merge branch 'webapi-support-immutable-construct-params' of github.com:phoenix128/magento2 into webapi-support-immutable-construct-params
2 parents 68e5dcd + 6e68edf commit a63a3b5

File tree

7,687 files changed

+325055
-100155
lines changed

Some content is hidden

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

7,687 files changed

+325055
-100155
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ atlassian*
3434
/.php_cs.cache
3535
/grunt-config.json
3636
/dev/tools/grunt/configs/local-themes.js
37-
3837
/pub/media/*.*
3938
!/pub/media/.htaccess
4039
/pub/media/attribute/*

.htaccess

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,15 @@
355355
Require all denied
356356
</IfVersion>
357357
</Files>
358+
<Files auth.json>
359+
<IfVersion < 2.4>
360+
order allow,deny
361+
deny from all
362+
</IfVersion>
363+
<IfVersion >= 2.4>
364+
Require all denied
365+
</IfVersion>
366+
</Files>
358367

359368
# For 404s and 403s that aren't handled by the application, show plain 404 response
360369
ErrorDocument 404 /pub/errors/404.php

.htaccess.sample

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@
111111
############################################
112112
## enable rewrites
113113

114-
Options +FollowSymLinks
114+
# The following line has better security but add some performance overhead - see https://httpd.apache.org/docs/2.4/en/misc/perf-tuning.html
115+
Options -FollowSymLinks +SymLinksIfOwnerMatch
115116
RewriteEngine on
116117

117118
############################################
@@ -331,6 +332,15 @@
331332
Require all denied
332333
</IfVersion>
333334
</Files>
335+
<Files auth.json>
336+
<IfVersion < 2.4>
337+
order allow,deny
338+
deny from all
339+
</IfVersion>
340+
<IfVersion >= 2.4>
341+
Require all denied
342+
</IfVersion>
343+
</Files>
334344

335345
# For 404s and 403s that aren't handled by the application, show plain 404 response
336346
ErrorDocument 404 /pub/errors/404.php

.php_cs.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66

77
/**
8-
* Pre-commit hook installation:
9-
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit
8+
* PHP Coding Standards fixer configuration
109
*/
10+
1111
$finder = PhpCsFixer\Finder::create()
1212
->name('*.phtml')
1313
->exclude('dev/tests/functional/generated')

.travis.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ addons:
1111
firefox: "46.0"
1212
hosts:
1313
- magento2.travis
14+
services:
15+
- rabbitmq
16+
- elasticsearch
1417
language: php
1518
php:
16-
- 7.0
1719
- 7.1
20+
- 7.2
1821
env:
1922
global:
2023
- COMPOSER_BIN_DIR=~/bin
@@ -32,13 +35,13 @@ env:
3235
- TEST_SUITE=functional
3336
matrix:
3437
exclude:
35-
- php: 7.0
38+
- php: 7.1
3639
env: TEST_SUITE=static
37-
- php: 7.0
40+
- php: 7.1
3841
env: TEST_SUITE=js GRUNT_COMMAND=spec
39-
- php: 7.0
42+
- php: 7.1
4043
env: TEST_SUITE=js GRUNT_COMMAND=static
41-
- php: 7.0
44+
- php: 7.1
4245
env: TEST_SUITE=functional
4346
cache:
4447
apt: true
@@ -47,7 +50,9 @@ cache:
4750
- $HOME/.nvm
4851
- $HOME/node_modules
4952
- $HOME/yarn.lock
50-
before_install: ./dev/travis/before_install.sh
53+
before_install:
54+
- curl -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.3.0/elasticsearch-2.3.0.deb && sudo dpkg -i --force-confnew elasticsearch-2.3.0.deb && sudo service elasticsearch restart
55+
- ./dev/travis/before_install.sh
5156
install: composer install --no-interaction
5257
before_script: ./dev/travis/before_script.sh
5358
script:

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-2018 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: 11 additions & 8 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.3-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>
5-
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting edge, feature-rich eCommerce solution that gets results.
6+
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

@@ -38,8 +39,10 @@ To suggest documentation improvements, click [here][4].
3839
| ![reject](http://devdocs.magento.com/common/images/github_reject.png) | The pull request has been rejected and will not be merged into mainline code. Possible reasons can include but are not limited to: issue has already been fixed in another code contribution, or there is an issue with the code contribution. |
3940
| ![bug report](http://devdocs.magento.com/common/images/github_bug.png) | The Magento Team has confirmed that this issue contains the minimum required information to reproduce. |
4041
| ![acknowledged](http://devdocs.magento.com/common/images/gitHub_acknowledged.png) | The Magento Team has validated the issue and an internal ticket has been created. |
41-
| ![acknowledged](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. |
42-
| ![acknowledged](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. |
42+
| ![in progress](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. |
43+
| ![needs update](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. |
44+
45+
To learn more about issue gate labels click [here](https://github.com/magento/magento2/wiki/Magento-Issue-Gates)
4346

4447
<h2>Reporting security issues</h2>
4548

app/bootstrap.php

Lines changed: 5 additions & 4 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;
@@ -49,12 +49,13 @@
4949
unset($_SERVER['ORIG_PATH_INFO']);
5050
}
5151

52-
if (!empty($_SERVER['MAGE_PROFILER'])
52+
if (
53+
(!empty($_SERVER['MAGE_PROFILER']) || file_exists(BP . '/var/profiler.flag'))
5354
&& isset($_SERVER['HTTP_ACCEPT'])
5455
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
5556
) {
5657
\Magento\Framework\Profiler::applyConfig(
57-
$_SERVER['MAGE_PROFILER'],
58+
(isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER'])) ? $_SERVER['MAGE_PROFILER'] : trim(file_get_contents(BP . '/var/profiler.flag')),
5859
BP,
5960
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
6061
);

app/code/Magento/AdminNotification/Block/System/Messages.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,34 @@ class Messages extends \Magento\Backend\Block\Template
1616

1717
/**
1818
* @var \Magento\Framework\Json\Helper\Data
19+
* @deprecated
1920
*/
2021
protected $jsonHelper;
2122

23+
/**
24+
* @var \Magento\Framework\Serialize\Serializer\Json
25+
*/
26+
private $serializer;
27+
2228
/**
2329
* @param \Magento\Backend\Block\Template\Context $context
2430
* @param \Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized $messages
2531
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
2632
* @param array $data
33+
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
2734
*/
2835
public function __construct(
2936
\Magento\Backend\Block\Template\Context $context,
3037
\Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized $messages,
3138
\Magento\Framework\Json\Helper\Data $jsonHelper,
32-
array $data = []
39+
array $data = [],
40+
\Magento\Framework\Serialize\Serializer\Json $serializer = null
3341
) {
3442
$this->jsonHelper = $jsonHelper;
3543
parent::__construct($context, $data);
3644
$this->_messages = $messages;
45+
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
46+
->get(\Magento\Framework\Serialize\Serializer\Json::class);
3747
}
3848

3949
/**
@@ -117,7 +127,7 @@ protected function _getMessagesUrl()
117127
*/
118128
public function getSystemMessageDialogJson()
119129
{
120-
return $this->jsonHelper->jsonEncode(
130+
return $this->serializer->serialize(
121131
[
122132
'systemMessageDialog' => [
123133
'buttons' => [],

app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ public function getPopupTitle()
7777
$messageCount = count($this->_messages->getUnread());
7878
if ($messageCount > 1) {
7979
return __('You have %1 new system messages', $messageCount);
80-
} else {
81-
return __('You have %1 new system message', $messageCount);
8280
}
81+
return __('You have %1 new system message', $messageCount);
8382
}
8483

8584
/**

app/code/Magento/AdminNotification/Block/Window.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ protected function _getLatestItem()
9898
{
9999
if ($this->_latestItem == null) {
100100
$items = array_values($this->_criticalCollection->getItems());
101+
$this->_latestItem = false;
101102
if (count($items)) {
102103
$this->_latestItem = $items[0];
103-
} else {
104-
$this->_latestItem = false;
105104
}
106105
}
107106
return $this->_latestItem;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public function execute()
2828
)->markAsRead(
2929
$notificationId
3030
);
31-
$this->messageManager->addSuccess(__('The message has been marked as Read.'));
31+
$this->messageManager->addSuccessMessage(__('The message has been marked as Read.'));
3232
} catch (\Magento\Framework\Exception\LocalizedException $e) {
33-
$this->messageManager->addError($e->getMessage());
33+
$this->messageManager->addErrorMessage($e->getMessage());
3434
} catch (\Exception $e) {
35-
$this->messageManager->addException(
35+
$this->messageManager->addExceptionMessage(
3636
$e,
3737
__("We couldn't mark the notification as Read because of an error.")
3838
);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function execute()
2323
{
2424
$ids = $this->getRequest()->getParam('notification');
2525
if (!is_array($ids)) {
26-
$this->messageManager->addError(__('Please select messages.'));
26+
$this->messageManager->addErrorMessage(__('Please select messages.'));
2727
} else {
2828
try {
2929
foreach ($ids as $id) {
@@ -32,13 +32,13 @@ public function execute()
3232
$model->setIsRead(1)->save();
3333
}
3434
}
35-
$this->messageManager->addSuccess(
35+
$this->messageManager->addSuccessMessage(
3636
__('A total of %1 record(s) have been marked as Read.', count($ids))
3737
);
3838
} catch (\Magento\Framework\Exception\LocalizedException $e) {
39-
$this->messageManager->addError($e->getMessage());
39+
$this->messageManager->addErrorMessage($e->getMessage());
4040
} catch (\Exception $e) {
41-
$this->messageManager->addException(
41+
$this->messageManager->addExceptionMessage(
4242
$e,
4343
__("We couldn't mark the notification as Read because of an error.")
4444
);

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function execute()
2323
{
2424
$ids = $this->getRequest()->getParam('notification');
2525
if (!is_array($ids)) {
26-
$this->messageManager->addError(__('Please select messages.'));
26+
$this->messageManager->addErrorMessage(__('Please select messages.'));
2727
} else {
2828
try {
2929
foreach ($ids as $id) {
@@ -32,13 +32,16 @@ public function execute()
3232
$model->setIsRemove(1)->save();
3333
}
3434
}
35-
$this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids)));
35+
$this->messageManager->addSuccessMessage(__('Total of %1 record(s) have been removed.', count($ids)));
3636
} catch (\Magento\Framework\Exception\LocalizedException $e) {
37-
$this->messageManager->addError($e->getMessage());
37+
$this->messageManager->addErrorMessage($e->getMessage());
3838
} catch (\Exception $e) {
39-
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
39+
$this->messageManager->addExceptionMessage(
40+
$e,
41+
__("We couldn't remove the messages because of an error.")
42+
);
4043
}
4144
}
42-
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
45+
$this->_redirect('adminhtml/*/');
4346
}
4447
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ public function execute()
3131

3232
try {
3333
$model->setIsRemove(1)->save();
34-
$this->messageManager->addSuccess(__('The message has been removed.'));
34+
$this->messageManager->addSuccessMessage(__('The message has been removed.'));
3535
} catch (\Magento\Framework\Exception\LocalizedException $e) {
36-
$this->messageManager->addError($e->getMessage());
36+
$this->messageManager->addErrorMessage($e->getMessage());
3737
} catch (\Exception $e) {
38-
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
38+
$this->messageManager->addExceptionMessage(
39+
$e,
40+
__("We couldn't remove the messages because of an error.")
41+
);
3942
}
4043

4144
$this->_redirect('adminhtml/*/');

app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
*/
77
namespace Magento\AdminNotification\Controller\Adminhtml\System\Message;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
911
class ListAction extends \Magento\Backend\App\AbstractAction
1012
{
1113
/**
@@ -15,6 +17,7 @@ class ListAction extends \Magento\Backend\App\AbstractAction
1517

1618
/**
1719
* @var \Magento\Framework\Json\Helper\Data
20+
* @deprecated
1821
*/
1922
protected $jsonHelper;
2023

@@ -41,7 +44,7 @@ public function __construct(
4144
}
4245

4346
/**
44-
* @return void
47+
* @return \Magento\Framework\Controller\Result\Json
4548
*/
4649
public function execute()
4750
{
@@ -63,6 +66,9 @@ public function execute()
6366
. 'Please refresh the web page to clear the notice alert.',
6467
];
6568
}
66-
$this->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
69+
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
70+
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
71+
$resultJson->setData($result);
72+
return $resultJson;
6773
}
6874
}

app/code/Magento/AdminNotification/Model/Feed.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ public function getFeedData()
214214
);
215215
$curl->write(\Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
216216
$data = $curl->read();
217-
if ($data === false) {
218-
return false;
219-
}
220217
$data = preg_split('/^\r?$/m', $data, 2);
221218
$data = trim($data[1]);
222219
$curl->close();

0 commit comments

Comments
 (0)