Skip to content

Commit dafed05

Browse files
committed
Merge branch 'develop' of github.corp.ebay.com:magento2/magento2ce into Troll_S31
2 parents 0466474 + d1a0d51 commit dafed05

File tree

1,469 files changed

+18270
-15140
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,469 files changed

+18270
-15140
lines changed

Gruntfile.js

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ module.exports = function (grunt) {
3535
tmpSource: 'var/view_preprocessed/source/',
3636
tmp: 'var',
3737
css: {
38-
setup: 'setup/pub/magento/setup/css'
38+
setup: 'setup/pub/styles'
3939
},
4040
less: {
41-
setup: 'setup/module/Magento/Setup/styles'
41+
setup: 'setup/view/styles'
4242
},
4343
uglify: {
4444
legacy: 'lib/web/legacy-build.min.js'
@@ -126,6 +126,23 @@ module.exports = function (grunt) {
126126
}
127127
};
128128

129+
// Banners
130+
// ---------------------------------------------
131+
132+
var banner = {
133+
firstLine: 'Copyright © <%= grunt.template.today("yyyy") %> Magento. All rights reserved.',
134+
secondLine: 'See COPYING.txt for license details.',
135+
css: function(){
136+
return '/**\n * ' + this.firstLine + '\n * ' + this.secondLine + '\n */\n';
137+
},
138+
less: function(){
139+
return '// /**\n// * ' + this.firstLine + '\n// * ' + this.secondLine + '\n// */\n';
140+
},
141+
html: function(){
142+
return '<!--\n/**\n * ' + this.firstLine + '\n * ' + this.secondLine + '\n */\n-->\n';
143+
}
144+
};
145+
129146
// Tasks
130147
// _____________________________________________
131148

@@ -135,6 +152,7 @@ module.exports = function (grunt) {
135152
path: path,
136153
theme: theme,
137154
combo: combo,
155+
banner: banner,
138156

139157
// Execution into cmd
140158
// ---------------------------------------------
@@ -343,21 +361,48 @@ module.exports = function (grunt) {
343361
}
344362
},
345363

346-
// Concatenation
364+
// Banners
347365
// ---------------------------------------------
348366

349-
concat: {
367+
usebanner: {
350368
options: {
351-
stripBanners: true,
352-
banner: '/**\n * Copyright © <%= grunt.template.today("yyyy") %> Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n'
369+
position: 'top',
370+
linebreak: true
353371
},
354372
setup: {
355-
src: '<%= path.css.setup %>/setup.css',
356-
dest: '<%= path.css.setup %>/setup.css'
373+
options: {
374+
banner: banner.css()
375+
},
376+
files: {
377+
src: '<%= path.css.setup %>/*.css'
378+
}
379+
},
380+
documentationCss: {
381+
options: {
382+
banner: banner.css()
383+
},
384+
files: {
385+
src: '<%= path.doc %>/**/*.css'
386+
}
387+
},
388+
documentationLess: {
389+
options: {
390+
banner: banner.less()
391+
},
392+
files: {
393+
src: '<%= path.doc %>/**/*.less'
394+
}
395+
},
396+
documentationHtml: {
397+
options: {
398+
banner: banner.html()
399+
},
400+
files: {
401+
src: '<%= path.doc %>/**/*.html'
402+
}
357403
}
358404
},
359405

360-
361406
// Watches files for changes and runs tasks based on the changed files
362407
// ---------------------------------------------
363408

@@ -552,6 +597,12 @@ module.exports = function (grunt) {
552597
'clean:pub'
553598
]);
554599

600+
grunt.registerTask('documentation-banners', [
601+
'usebanner:documentationCss',
602+
'usebanner:documentationLess',
603+
'usebanner:documentationHtml'
604+
]);
605+
555606
// Production
556607
// ---------------------------------------------
557608

@@ -561,7 +612,7 @@ module.exports = function (grunt) {
561612
'less:' + component,
562613
'autoprefixer:' + component,
563614
'cssmin:' + component,
564-
'concat:' + component
615+
'usebanner:' + component
565616
]);
566617
}
567618
if (component == undefined) {

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 <core@magentocommerce.com>
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>

0 commit comments

Comments
 (0)