Skip to content

Commit a82042e

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-85617
2 parents b96e014 + dea8b32 commit a82042e

File tree

2,573 files changed

+82599
-6135
lines changed

Some content is hidden

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

2,573 files changed

+82599
-6135
lines changed

.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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,15 @@
332332
Require all denied
333333
</IfVersion>
334334
</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>
335344

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

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ addons:
1111
firefox: "46.0"
1212
hosts:
1313
- magento2.travis
14+
services:
15+
- rabbitmq
16+
- elasticsearch
1417
language: php
1518
php:
1619
- 7.0
@@ -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:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
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>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="urn:magento:setup:Model/Declaration/Schema/etc/schema.xsd">
9+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
1010
<table name="adminnotification_inbox" resource="default" engine="innodb" comment="Adminnotification Inbox">
1111
<column xsi:type="int" name="notification_id" padding="10" unsigned="true" nullable="false" identity="true"
1212
comment="Notification id"/>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdvancedSearch\Block\Adminhtml\Search;
7+
8+
/**
9+
* Search queries relations grid container
10+
*
11+
* @api
12+
* @author Magento Core Team <core@magentocommerce.com>
13+
* @since 100.0.2
14+
*/
15+
class Edit extends \Magento\Backend\Block\Widget\Grid\Container
16+
{
17+
/**
18+
* Enable grid container
19+
*
20+
* @return void
21+
*/
22+
protected function _construct()
23+
{
24+
$this->_blockGroup = 'Magento_AdvancedSearch';
25+
$this->_controller = 'adminhtml_search';
26+
$this->_headerText = __('Related Search Terms');
27+
$this->_addButtonLabel = __('Add New Search Term');
28+
parent::_construct();
29+
$this->buttonList->remove('add');
30+
}
31+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdvancedSearch\Block\Adminhtml\Search;
7+
8+
/**
9+
* Search query relations edit grid
10+
*
11+
* @api
12+
* @author Magento Core Team <core@magentocommerce.com>
13+
* @since 100.0.2
14+
*/
15+
class Grid extends \Magento\Backend\Block\Widget\Grid
16+
{
17+
/**
18+
* @var \Magento\AdvancedSearch\Model\Adminhtml\Search\Grid\Options
19+
*/
20+
protected $_options;
21+
22+
/**
23+
* @var \Magento\Framework\Registry
24+
*/
25+
protected $_registryManager;
26+
27+
/**
28+
* @var \Magento\Framework\Json\Helper\Data
29+
*/
30+
protected $jsonHelper;
31+
32+
/**
33+
* @param \Magento\Backend\Block\Template\Context $context
34+
* @param \Magento\Backend\Helper\Data $backendHelper
35+
* @param \Magento\AdvancedSearch\Model\Adminhtml\Search\Grid\Options $options
36+
* @param \Magento\Framework\Registry $registry
37+
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
38+
* @param array $data
39+
*/
40+
public function __construct(
41+
\Magento\Backend\Block\Template\Context $context,
42+
\Magento\Backend\Helper\Data $backendHelper,
43+
\Magento\AdvancedSearch\Model\Adminhtml\Search\Grid\Options $options,
44+
\Magento\Framework\Registry $registry,
45+
\Magento\Framework\Json\Helper\Data $jsonHelper,
46+
array $data = []
47+
) {
48+
$this->jsonHelper = $jsonHelper;
49+
parent::__construct($context, $backendHelper, $data);
50+
$this->_options = $options;
51+
$this->_registryManager = $registry;
52+
$this->setDefaultFilter(['query_id_selected' => 1]);
53+
}
54+
55+
/**
56+
* Retrieve a value from registry by a key
57+
*
58+
* @return mixed
59+
*/
60+
public function getQuery()
61+
{
62+
return $this->_registryManager->registry('current_catalog_search');
63+
}
64+
65+
/**
66+
* Add column filter to collection
67+
*
68+
* @param \Magento\Backend\Block\Widget\Grid\Column $column
69+
* @return $this
70+
*/
71+
protected function _addColumnFilterToCollection($column)
72+
{
73+
// Set custom filter for query selected flag
74+
if ($column->getId() == 'query_id_selected' && $this->getQuery()->getId()) {
75+
$selectedIds = $this->getSelectedQueries();
76+
if (empty($selectedIds)) {
77+
$selectedIds = 0;
78+
}
79+
if ($column->getFilter()->getValue()) {
80+
$this->getCollection()->addFieldToFilter('query_id', ['in' => $selectedIds]);
81+
} elseif (!empty($selectedIds)) {
82+
$this->getCollection()->addFieldToFilter('query_id', ['nin' => $selectedIds]);
83+
}
84+
} else {
85+
parent::_addColumnFilterToCollection($column);
86+
}
87+
return $this;
88+
}
89+
90+
/**
91+
* Retrieve selected related queries from grid
92+
*
93+
* @return array
94+
*/
95+
public function getSelectedQueries()
96+
{
97+
return $this->_options->toOptionArray();
98+
}
99+
100+
/**
101+
* Get queries json
102+
*
103+
* @return string
104+
*/
105+
public function getQueriesJson()
106+
{
107+
$queries = array_flip($this->getSelectedQueries());
108+
if (!empty($queries)) {
109+
return $this->jsonHelper->jsonEncode($queries);
110+
}
111+
return '{}';
112+
}
113+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdvancedSearch\Block\Adminhtml\System\Config;
7+
8+
/**
9+
* Search engine test connection block
10+
* @api
11+
* @since 100.1.0
12+
*/
13+
class TestConnection extends \Magento\Config\Block\System\Config\Form\Field
14+
{
15+
/**
16+
* Set template to itself
17+
*
18+
* @return $this
19+
* @since 100.1.0
20+
*/
21+
protected function _prepareLayout()
22+
{
23+
parent::_prepareLayout();
24+
$this->setTemplate('Magento_AdvancedSearch::system/config/testconnection.phtml');
25+
return $this;
26+
}
27+
28+
/**
29+
* Unset some non-related element parameters
30+
*
31+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
32+
* @return string
33+
* @since 100.1.0
34+
*/
35+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
36+
{
37+
$element = clone $element;
38+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
39+
return parent::render($element);
40+
}
41+
42+
/**
43+
* Get the button and scripts contents
44+
*
45+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
46+
* @return string
47+
* @since 100.1.0
48+
*/
49+
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
50+
{
51+
$originalData = $element->getOriginalData();
52+
$this->addData(
53+
[
54+
'button_label' => __($originalData['button_label']),
55+
'html_id' => $element->getHtmlId(),
56+
'ajax_url' => $this->_urlBuilder->getUrl('catalog/search_system_config/testconnection'),
57+
'field_mapping' => str_replace('"', '\\"', json_encode($this->_getFieldMapping()))
58+
]
59+
);
60+
61+
return $this->_toHtml();
62+
}
63+
64+
/**
65+
* Returns configuration fields required to perform the ping request
66+
*
67+
* @return array
68+
* @since 100.1.0
69+
*/
70+
protected function _getFieldMapping()
71+
{
72+
return ['engine' => 'catalog_search_engine'];
73+
}
74+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdvancedSearch\Block;
7+
8+
/**
9+
* @api
10+
* @since 100.0.2
11+
*/
12+
class Recommendations extends SearchData
13+
{
14+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdvancedSearch\Block;
7+
8+
use Magento\Framework\View\Element\Template;
9+
use Magento\Search\Model\QueryFactoryInterface;
10+
use Magento\Search\Model\QueryInterface;
11+
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
12+
13+
abstract class SearchData extends Template implements SearchDataInterface
14+
{
15+
/**
16+
* @var QueryInterface
17+
*/
18+
private $query;
19+
20+
/**
21+
* @var string
22+
*/
23+
protected $title;
24+
25+
/**
26+
* @var SuggestedQueriesInterface
27+
*/
28+
private $searchDataProvider;
29+
30+
/**
31+
* @var string
32+
*/
33+
protected $_template = 'search_data.phtml';
34+
35+
/**
36+
* @param Template\Context $context
37+
* @param SuggestedQueriesInterface $searchDataProvider
38+
* @param QueryFactoryInterface $queryFactory
39+
* @param string $title
40+
* @param array $data
41+
*/
42+
public function __construct(
43+
Template\Context $context,
44+
SuggestedQueriesInterface $searchDataProvider,
45+
QueryFactoryInterface $queryFactory,
46+
$title,
47+
array $data = []
48+
) {
49+
$this->searchDataProvider = $searchDataProvider;
50+
$this->query = $queryFactory->get();
51+
$this->title = $title;
52+
parent::__construct($context, $data);
53+
}
54+
55+
/**
56+
* {@inheritdoc}
57+
*/
58+
public function getItems()
59+
{
60+
return $this->searchDataProvider->getItems($this->query);
61+
}
62+
63+
/**
64+
* {@inheritdoc}
65+
*/
66+
public function isShowResultsCount()
67+
{
68+
return $this->searchDataProvider->isResultsCountEnabled();
69+
}
70+
71+
/**
72+
* {@inheritdoc}
73+
*/
74+
public function getLink($queryText)
75+
{
76+
return $this->getUrl('*/*/') . '?q=' . urlencode($queryText);
77+
}
78+
79+
/**
80+
* {@inheritdoc}
81+
*/
82+
public function getTitle()
83+
{
84+
return __($this->title);
85+
}
86+
}

0 commit comments

Comments
 (0)