Skip to content

Commit 8f68565

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into public-pulls
2 parents 65fee49 + 116d26d commit 8f68565

File tree

1,181 files changed

+7055
-4150
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,181 files changed

+7055
-4150
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function execute()
2222
$notificationId
2323
);
2424
$this->messageManager->addSuccess(__('The message has been marked as Read.'));
25-
} catch (\Magento\Framework\Model\Exception $e) {
25+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
2626
$this->messageManager->addError($e->getMessage());
2727
} catch (\Exception $e) {
2828
$this->messageManager->addException(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function execute()
2727
$this->messageManager->addSuccess(
2828
__('A total of %1 record(s) have been marked as Read.', count($ids))
2929
);
30-
} catch (\Magento\Framework\Model\Exception $e) {
30+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
3131
$this->messageManager->addError($e->getMessage());
3232
} catch (\Exception $e) {
3333
$this->messageManager->addException(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function execute()
2525
}
2626
}
2727
$this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids)));
28-
} catch (\Magento\Framework\Model\Exception $e) {
28+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
2929
$this->messageManager->addError($e->getMessage());
3030
} catch (\Exception $e) {
3131
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function execute()
2424
try {
2525
$model->setIsRemove(1)->save();
2626
$this->messageManager->addSuccess(__('The message has been removed.'));
27-
} catch (\Magento\Framework\Model\Exception $e) {
27+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
2828
$this->messageManager->addError($e->getMessage());
2929
} catch (\Exception $e) {
3030
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));

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

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* AdminNotification Feed model
1010
*
1111
* @author Magento Core Team <[email protected]>
12+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1213
*/
1314
class Feed extends \Magento\Framework\Model\AbstractModel
1415
{
@@ -50,16 +51,29 @@ class Feed extends \Magento\Framework\Model\AbstractModel
5051
*/
5152
protected $_deploymentConfig;
5253

54+
/**
55+
* @var \Magento\Framework\App\ProductMetadataInterface
56+
*/
57+
protected $productMetadata;
58+
59+
/**
60+
* @var \Magento\Framework\UrlInterface
61+
*/
62+
protected $urlBuilder;
63+
5364
/**
5465
* @param \Magento\Framework\Model\Context $context
5566
* @param \Magento\Framework\Registry $registry
5667
* @param \Magento\Backend\App\ConfigInterface $backendConfig
57-
* @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory
58-
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
68+
* @param InboxFactory $inboxFactory
69+
* @param \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory
5970
* @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
71+
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
72+
* @param \Magento\Framework\UrlInterface $urlBuilder
73+
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
6074
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
61-
* @param \Magento\Framework\HTTP\Adapter\curlFactory $curlFactory
6275
* @param array $data
76+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6377
*/
6478
public function __construct(
6579
\Magento\Framework\Model\Context $context,
@@ -68,15 +82,19 @@ public function __construct(
6882
\Magento\AdminNotification\Model\InboxFactory $inboxFactory,
6983
\Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory,
7084
\Magento\Framework\App\DeploymentConfig $deploymentConfig,
85+
\Magento\Framework\App\ProductMetadataInterface $productMetadata,
86+
\Magento\Framework\UrlInterface $urlBuilder,
7187
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
7288
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
7389
array $data = []
7490
) {
7591
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
76-
$this->_backendConfig = $backendConfig;
77-
$this->_inboxFactory = $inboxFactory;
78-
$this->curlFactory = $curlFactory;
92+
$this->_backendConfig = $backendConfig;
93+
$this->_inboxFactory = $inboxFactory;
94+
$this->curlFactory = $curlFactory;
7995
$this->_deploymentConfig = $deploymentConfig;
96+
$this->productMetadata = $productMetadata;
97+
$this->urlBuilder = $urlBuilder;
8098
}
8199

82100
/**
@@ -191,7 +209,15 @@ public function setLastUpdate()
191209
public function getFeedData()
192210
{
193211
$curl = $this->curlFactory->create();
194-
$curl->setConfig(['timeout' => 2]);
212+
$curl->setConfig(
213+
[
214+
'timeout' => 2,
215+
'useragent' => $this->productMetadata->getName()
216+
. '/' . $this->productMetadata->getVersion()
217+
. ' (' . $this->productMetadata->getEdition() . ')',
218+
'referer' => $this->urlBuilder->getUrl('*/*/*')
219+
]
220+
);
195221
$curl->write(\Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
196222
$data = $curl->read();
197223
if ($data === false) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ public function parse(array $data)
107107
* @param string|string[] $description
108108
* @param string $url
109109
* @param bool $isInternal
110-
* @throws \Magento\Framework\Model\Exception
110+
* @throws \Magento\Framework\Exception\LocalizedException
111111
* @return $this
112112
*/
113113
public function add($severity, $title, $description, $url = '', $isInternal = true)
114114
{
115115
if (!$this->getSeverities($severity)) {
116-
throw new \Magento\Framework\Model\Exception(__('Wrong message type'));
116+
throw new \Magento\Framework\Exception\LocalizedException(__('Wrong message type'));
117117
}
118118
if (is_array($description)) {
119119
$description = '<ul><li>' . implode('</li><li>', $description) . '</li></ul>';

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function __construct(\Magento\AdminNotification\Model\InboxFactory $notif
3030
*
3131
* @param int $notificationId
3232
* @return void
33-
* @throws \Magento\Framework\Model\Exception
33+
* @throws \Magento\Framework\Exception\LocalizedException
3434
*/
3535
public function markAsRead($notificationId)
3636
{
3737
$notification = $this->_notificationFactory->create();
3838
$notification->load($notificationId);
3939
if (!$notification->getId()) {
40-
throw new \Magento\Framework\Model\Exception('Wrong notification ID specified.');
40+
throw new \Magento\Framework\Exception\LocalizedException(__('Wrong notification ID specified.'));
4141
}
4242
$notification->setIsRead(1);
4343
$notification->save();

app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function _getConfigUrl()
6767
) {
6868
$output = $this->_urlBuilder->getUrl('adminhtml/system_config/edit', ['section' => 'web']);
6969
} else {
70-
/** @var $dataCollection \Magento\Core\Model\Resource\Config\Data\Collection */
70+
/** @var $dataCollection \Magento\Config\Model\Resource\Config\Data\Collection */
7171
$dataCollection = $this->_configValueFactory->create()->getCollection();
7272
$dataCollection->addValueFilter(\Magento\Store\Model\Store::BASE_URL_PLACEHOLDER);
7373

app/code/Magento/AdminNotification/etc/adminhtml/system.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/system_file.xsd">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd">
99
<system>
1010
<section id="system">
1111
<group id="adminnotification" translate="label" type="text" sortOrder="250" showInDefault="1" showInWebsite="0" showInStore="0">
1212
<label>Notifications</label>
1313
<field id="use_https" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
1414
<label>Use HTTPS to Get Feed</label>
15-
<source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
15+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1616
</field>
1717
<field id="frequency" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0">
1818
<label>Update Frequency</label>
1919
<source_model>Magento\AdminNotification\Model\Config\Source\Frequency</source_model>
2020
</field>
2121
<field id="last_update" translate="label" type="label" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
2222
<label>Last Update</label>
23-
<frontend_model>Magento\Backend\Block\System\Config\Form\Field\Notification</frontend_model>
23+
<frontend_model>Magento\Config\Block\System\Config\Form\Field\Notification</frontend_model>
2424
</field>
2525
</group>
2626
</section>

app/code/Magento/AdminNotification/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<default>
1010
<system>
1111
<adminnotification>
12-
<feed_url>notifications.magentocommerce.com/community/notifications.rss</feed_url>
12+
<feed_url>notifications.magentocommerce.com/magento2/community/notifications.rss</feed_url>
1313
<popup_url>widgets.magentocommerce.com/notificationPopup</popup_url>
1414
<severity_icons_url>widgets.magentocommerce.com/%s/%s.gif</severity_icons_url>
1515
<use_https>0</use_https>

app/code/Magento/Authorization/Model/Acl/AclRetriever.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getAllowedResourcesByUser($userType, $userId)
8383
} catch (\Exception $e) {
8484
$this->logger->critical($e);
8585
throw new LocalizedException(
86-
'Error happened while getting a list of allowed resources. Check exception log for details.'
86+
__('Error happened while getting a list of allowed resources. Check exception log for details.')
8787
);
8888
}
8989
return $allowedResources;

app/code/Magento/Authorization/Model/Resource/Rules.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function _construct()
7373
*
7474
* @param \Magento\Authorization\Model\Rules $rule
7575
* @return void
76-
* @throws \Magento\Framework\Model\Exception
76+
* @throws \Magento\Framework\Exception\LocalizedException
7777
*/
7878
public function saveRel(\Magento\Authorization\Model\Rules $rule)
7979
{
@@ -115,7 +115,7 @@ public function saveRel(\Magento\Authorization\Model\Rules $rule)
115115

116116
$adapter->commit();
117117
$this->_aclCache->clean();
118-
} catch (\Magento\Framework\Model\Exception $e) {
118+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
119119
$adapter->rollBack();
120120
throw $e;
121121
} catch (\Exception $e) {

app/code/Magento/Backend/App/Action/Plugin/Authentication.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
22
/**
3-
*
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Backend\App\Action\Plugin;
87

8+
use Magento\Framework\Exception\AuthenticationException;
9+
910
class Authentication
1011
{
1112
/**
@@ -167,7 +168,7 @@ protected function _performLogin(\Magento\Framework\App\RequestInterface $reques
167168

168169
try {
169170
$this->_auth->login($username, $password);
170-
} catch (\Magento\Backend\Model\Auth\Exception $e) {
171+
} catch (AuthenticationException $e) {
171172
if (!$request->getParam('messageSent')) {
172173
$this->messageManager->addError($e->getMessage());
173174
$request->setParam('messageSent', true);

app/code/Magento/Backend/App/UserConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
namespace Magento\Backend\App;
99

10-
use Magento\Backend\Model\Config\Factory;
10+
use Magento\Config\Model\Config\Factory;
1111
use Magento\Framework\App\Bootstrap;
1212
use Magento\Framework\App\Console\Response;
1313
use Magento\Framework\AppInterface;

app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @author Magento Core Team <[email protected]>
1515
*/
16-
class Reset extends \Magento\Backend\Block\System\Config\Form\Field
16+
class Reset extends \Magento\Config\Block\System\Config\Form\Field
1717
{
1818
/**
1919
* Pasge robots default instructions
@@ -39,7 +39,7 @@ public function __construct(
3939
protected function _construct()
4040
{
4141
parent::_construct();
42-
$this->setTemplate('page/system/config/robots/reset.phtml');
42+
$this->setTemplate('Magento_Config::page/system/config/robots/reset.phtml');
4343
}
4444

4545
/**

app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Dependence extends \Magento\Backend\Block\AbstractBlock
4040
protected $_configOptions = [];
4141

4242
/**
43-
* @var \Magento\Backend\Model\Config\Structure\Element\Dependency\FieldFactory
43+
* @var \Magento\Config\Model\Config\Structure\Element\Dependency\FieldFactory
4444
*/
4545
protected $_fieldFactory;
4646

@@ -52,13 +52,13 @@ class Dependence extends \Magento\Backend\Block\AbstractBlock
5252
/**
5353
* @param \Magento\Backend\Block\Context $context
5454
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
55-
* @param \Magento\Backend\Model\Config\Structure\Element\Dependency\FieldFactory $fieldFactory
55+
* @param \Magento\Config\Model\Config\Structure\Element\Dependency\FieldFactory $fieldFactory
5656
* @param array $data
5757
*/
5858
public function __construct(
5959
\Magento\Backend\Block\Context $context,
6060
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
61-
\Magento\Backend\Model\Config\Structure\Element\Dependency\FieldFactory $fieldFactory,
61+
\Magento\Config\Model\Config\Structure\Element\Dependency\FieldFactory $fieldFactory,
6262
array $data = []
6363
) {
6464
$this->_jsonEncoder = $jsonEncoder;
@@ -84,13 +84,13 @@ public function addFieldMap($fieldId, $fieldName)
8484
*
8585
* @param string $fieldName
8686
* @param string $fieldNameFrom
87-
* @param \Magento\Backend\Model\Config\Structure\Element\Dependency\Field|string $refField
87+
* @param \Magento\Config\Model\Config\Structure\Element\Dependency\Field|string $refField
8888
* @return \Magento\Backend\Block\Widget\Form\Element\Dependence
8989
*/
9090
public function addFieldDependence($fieldName, $fieldNameFrom, $refField)
9191
{
9292
if (!is_object($refField)) {
93-
/** @var $refField \Magento\Backend\Model\Config\Structure\Element\Dependency\Field */
93+
/** @var $refField \Magento\Config\Model\Config\Structure\Element\Dependency\Field */
9494
$refField = $this->_fieldFactory->create(
9595
['fieldData' => ['value' => (string)$refField], 'fieldPrefix' => '']
9696
);
@@ -139,7 +139,7 @@ protected function _getDependsJson()
139139
$result = [];
140140
foreach ($this->_depends as $to => $row) {
141141
foreach ($row as $from => $field) {
142-
/** @var $field \Magento\Backend\Model\Config\Structure\Element\Dependency\Field */
142+
/** @var $field \Magento\Config\Model\Config\Structure\Element\Dependency\Field */
143143
$result[$this->_fields[$to]][$this->_fields[$from]] = [
144144
'values' => $field->getValues(),
145145
'negative' => $field->isNegative(),

app/code/Magento/Backend/Block/Widget/Grid.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,15 @@ public function getColumnSet()
217217
/**
218218
* Retrieve export block
219219
*
220-
* @throws \Magento\Framework\Model\Exception
220+
* @throws \Magento\Framework\Exception\LocalizedException
221221
* @return \Magento\Framework\View\Element\AbstractBlock|bool
222222
*/
223223
public function getExportBlock()
224224
{
225225
if (!$this->getChildBlock('grid.export')) {
226-
throw new \Magento\Framework\Model\Exception('Export block for grid ' . $this->getNameInLayout() . ' is not defined');
226+
throw new \Magento\Framework\Exception\LocalizedException(
227+
__('Export block for grid %1 is not defined', $this->getNameInLayout())
228+
);
227229
}
228230
return $this->getChildBlock('grid.export');
229231
}

app/code/Magento/Backend/Block/Widget/Grid/Export.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ public function __construct(
6969

7070
/**
7171
* @return void
72-
* @throws \Magento\Framework\Model\Exception
72+
* @throws \Magento\Framework\Exception\LocalizedException
7373
*/
7474
protected function _construct()
7575
{
7676
parent::_construct();
7777
if ($this->hasData('exportTypes')) {
7878
foreach ($this->getData('exportTypes') as $type) {
7979
if (!isset($type['urlPath']) || !isset($type['label'])) {
80-
throw new \Magento\Framework\Model\Exception('Invalid export type supplied for grid export block');
80+
throw new \Magento\Framework\Exception\LocalizedException(
81+
__('Invalid export type supplied for grid export block')
82+
);
8183
}
8284
$this->addExportType($type['urlPath'], $type['label']);
8385
}

app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getMassaction()
4444
*
4545
* @param string|\Magento\Framework\View\Element\AbstractBlock $block
4646
* @return $this
47-
* @throws \Magento\Framework\Model\Exception
47+
* @throws \Magento\Framework\Exception\LocalizedException
4848
*/
4949
public function setAdditionalActionBlock($block)
5050
{
@@ -53,7 +53,7 @@ public function setAdditionalActionBlock($block)
5353
} elseif (is_array($block)) {
5454
$block = $this->_createFromConfig($block);
5555
} elseif (!$block instanceof \Magento\Framework\View\Element\AbstractBlock) {
56-
throw new \Magento\Framework\Model\Exception('Unknown block type');
56+
throw new \Magento\Framework\Exception\LocalizedException(__('Unknown block type'));
5757
}
5858

5959
$this->setChild('additional_action', $block);

0 commit comments

Comments
 (0)