Skip to content

Commit 1d3f003

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'mainline/develop' into jsonapi_compliant
2 parents 69e8c16 + eacba1c commit 1d3f003

File tree

80 files changed

+767
-154
lines changed

Some content is hidden

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

80 files changed

+767
-154
lines changed

app/bootstrap.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@
3131
require_once __DIR__ . '/autoload.php';
3232
require_once BP . '/app/functions.php';
3333

34-
if (!empty($_SERVER['MAGE_PROFILER'])) {
35-
\Magento\Framework\Profiler::applyConfig($_SERVER['MAGE_PROFILER'], BP, !empty($_REQUEST['isAjax']));
34+
if (!empty($_SERVER['MAGE_PROFILER'])
35+
&& isset($_SERVER['HTTP_ACCEPT'])
36+
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
37+
) {
38+
\Magento\Framework\Profiler::applyConfig(
39+
$_SERVER['MAGE_PROFILER'],
40+
BP,
41+
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
42+
);
3643
}
3744
if (ini_get('date.timezone') == '') {
3845
date_default_timezone_set('UTC');

app/code/Magento/Catalog/etc/product_options_merged.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
9-
<xs:redefine schemaLocation="product_options.xsd">
9+
<xs:redefine schemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
1010
<xs:complexType name="optionDeclaration">
1111
<xs:complexContent>
1212
<xs:restriction base="optionDeclaration">

app/code/Magento/Catalog/etc/product_types.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
9-
<xs:include schemaLocation="product_types_base.xsd" />
9+
<xs:include schemaLocation="urn:magento:module:Magento_Catalog:etc/product_types_base.xsd" />
1010

1111
<xs:element name="config">
1212
<xs:complexType>

app/code/Magento/Catalog/etc/product_types_merged.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
99

10-
<xs:include schemaLocation="product_types_base.xsd" />
10+
<xs:include schemaLocation="urn:magento:module:Magento_Catalog:etc/product_types_base.xsd" />
1111

1212
<xs:element name="config">
1313
<xs:complexType>

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">product_listing.product_listing_data_source</item>

app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<columns name="product_columns" class="Magento\Catalog\Ui\Component\Listing\Columns">
1010
<column name="qty">
1111
<argument name="data" xsi:type="array">

app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">cms_block_listing.cms_block_listing_data_source</item>

app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">cms_page_listing.cms_page_listing_data_source</item>

app/code/Magento/Config/Observer/Config/Backend/Admin/AfterCustomUrlChangedObserver.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,31 @@ class AfterCustomUrlChangedObserver implements ObserverInterface
3333
*/
3434
protected $_response;
3535

36-
/**
37-
* @var \Magento\Store\Model\StoreManagerInterface
38-
*/
39-
protected $_storeManager;
40-
4136
/**
4237
* @param \Magento\Backend\Helper\Data $backendData
4338
* @param \Magento\Framework\Registry $coreRegistry
4439
* @param \Magento\Backend\Model\Auth\Session $authSession
4540
* @param \Magento\Framework\App\ResponseInterface $response
46-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
4741
*/
4842
public function __construct(
4943
\Magento\Backend\Helper\Data $backendData,
5044
\Magento\Framework\Registry $coreRegistry,
5145
\Magento\Backend\Model\Auth\Session $authSession,
52-
\Magento\Framework\App\ResponseInterface $response,
53-
\Magento\Store\Model\StoreManagerInterface $storeManager
46+
\Magento\Framework\App\ResponseInterface $response
5447
) {
5548
$this->_backendData = $backendData;
5649
$this->_coreRegistry = $coreRegistry;
5750
$this->_authSession = $authSession;
5851
$this->_response = $response;
59-
$this->_storeManager = $storeManager;
6052
}
6153

6254
/**
63-
* Log out user and redirect him to new admin custom url
55+
* Log out user and redirect to new admin custom url
6456
*
6557
* @param \Magento\Framework\Event\Observer $observer
6658
* @return void
6759
* @SuppressWarnings(PHPMD.ExitExpression)
60+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6861
*/
6962
public function execute(\Magento\Framework\Event\Observer $observer)
7063
{
@@ -73,10 +66,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7366
}
7467

7568
$this->_authSession->destroy();
76-
77-
$route = $this->_backendData->getAreaFrontName();
78-
79-
$this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse();
69+
$adminUrl = $this->_backendData->getHomePageUrl();
70+
$this->_response->setRedirect($adminUrl)->sendResponse();
8071
exit(0);
8172
}
8273
}

app/code/Magento/Config/etc/system_include.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
9-
<xs:include schemaLocation="system_file.xsd"/>
9+
<xs:include schemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"/>
1010
<xs:element name="include" type="include" />
1111
<xs:complexType name="include">
1212
<xs:group minOccurs="1" maxOccurs="unbounded" ref="insertNodes"/>

app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">configurable_associated_product_listing.data_source</item>

app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">product_attributes_listing.product_attributes_listing_data_source</item>

app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>

app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">customer_online_grid.customer_online_grid_data_source</item>

app/code/Magento/Customer/view/base/ui_component/customer_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
8+
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
1010
<item name="js_config" xsi:type="array">
1111
<item name="provider" xsi:type="string">customer_form.customer_form_data_source</item>
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Developer\Console\Command;
8+
9+
use Magento\Framework\Exception\InputException;
10+
use Symfony\Component\Console\Command\Command;
11+
use Symfony\Component\Console\Input\InputArgument;
12+
use Symfony\Component\Console\Input\InputOption;
13+
use Symfony\Component\Console\Input\InputInterface;
14+
use Symfony\Component\Console\Output\OutputInterface;
15+
use Magento\Framework\App\Filesystem\DirectoryList;
16+
17+
/**
18+
* Class XmlCatalogGenerateCommand Generates dictionary of URNs for the IDE
19+
*
20+
* @SuppressWarnings(PMD.CouplingBetweenObjects)
21+
*/
22+
class XmlCatalogGenerateCommand extends Command
23+
{
24+
/**
25+
* Option for the type of IDE
26+
*/
27+
const IDE_OPTION = 'ide';
28+
29+
/**
30+
* Argument for the path to IDE config file
31+
*/
32+
const IDE_FILE_PATH_ARGUMENT = 'path';
33+
34+
/**
35+
* @var \Magento\Framework\App\Utility\Files
36+
*/
37+
private $filesUtility;
38+
39+
/**
40+
* @var \Magento\Framework\Config\Dom\UrnResolver
41+
*/
42+
private $urnResolver;
43+
44+
/**
45+
* @var \Magento\Framework\Filesystem\Directory\ReadInterface
46+
*/
47+
private $rootDirRead;
48+
49+
/**
50+
* Supported formats
51+
*
52+
* @var \Magento\Developer\Model\XmlCatalog\Format\FormatInterface[]
53+
*/
54+
private $formats;
55+
56+
/**
57+
* @param \Magento\Framework\App\Utility\Files $filesUtility
58+
* @param \Magento\Framework\Config\Dom\UrnResolver $urnResolver
59+
* @param \Magento\Framework\Filesystem $filesystemFactory
60+
* @param \Magento\Developer\Model\XmlCatalog\Format\FormatInterface[] $formats
61+
*/
62+
public function __construct(
63+
\Magento\Framework\App\Utility\Files $filesUtility,
64+
\Magento\Framework\Config\Dom\UrnResolver $urnResolver,
65+
\Magento\Framework\Filesystem $filesystemFactory,
66+
array $formats = []
67+
) {
68+
$this->filesUtility = $filesUtility;
69+
$this->urnResolver = $urnResolver;
70+
$this->formats = $formats;
71+
$this->rootDirRead = $filesystemFactory->getDirectoryRead(DirectoryList::ROOT);
72+
parent::__construct();
73+
}
74+
75+
/**
76+
* {@inheritdoc}
77+
*/
78+
protected function configure()
79+
{
80+
$this->setName('dev:urn-catalog:generate')
81+
->setDescription('Generates the catalog of URNs to *.xsd mappings for the IDE to highlight xml.')
82+
->setDefinition([
83+
new InputOption(
84+
self::IDE_OPTION,
85+
null,
86+
InputOption::VALUE_REQUIRED,
87+
'Format in which catalog will be generated. Supported: ['.
88+
implode(', ', $this->getSupportedFormats()) . ']',
89+
'phpstorm'
90+
),
91+
new InputArgument(
92+
self::IDE_FILE_PATH_ARGUMENT,
93+
InputArgument::REQUIRED,
94+
'Path to file to output the catalog. For PhpStorm use .idea/misc.xml'
95+
)
96+
]);
97+
98+
parent::configure();
99+
}
100+
101+
/**
102+
* Get an array of URNs
103+
*
104+
* @param OutputInterface $output
105+
* @return array
106+
*/
107+
private function getUrnDictionary(OutputInterface $output)
108+
{
109+
$files = $this->filesUtility->getXmlCatalogFiles('*.xml');
110+
$files = array_merge($files, $this->filesUtility->getXmlCatalogFiles('*.xsd'));
111+
112+
$urns = [];
113+
foreach ($files as $file) {
114+
$content = $this->rootDirRead->readFile(
115+
$this->rootDirRead->getRelativePath($file[0])
116+
);
117+
$matches = [];
118+
preg_match_all('/schemaLocation="(urn\:magento\:[^"]*)"/i', $content, $matches);
119+
if (isset($matches[1])) {
120+
$urns = array_merge($urns, $matches[1]);
121+
}
122+
}
123+
$urns = array_unique($urns);
124+
$paths = [];
125+
foreach ($urns as $urn) {
126+
try {
127+
$paths[$urn] = $this->urnResolver->getRealPath($urn);
128+
} catch (\Exception $e) {
129+
// don't add unsupported element to array
130+
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
131+
$output->writeln($e->getMessage());
132+
}
133+
}
134+
}
135+
return $paths;
136+
}
137+
138+
/**
139+
* {@inheritdoc}
140+
* @throws \InvalidArgumentException
141+
*/
142+
protected function execute(InputInterface $input, OutputInterface $output)
143+
{
144+
$ideName = $input->getOption(self::IDE_OPTION);
145+
$ideFilePath = $input->getArgument(self::IDE_FILE_PATH_ARGUMENT);
146+
147+
$urnDictionary = $this->getUrnDictionary($output);
148+
if ($formatter = $this->getFormatters($ideName)) {
149+
$formatter->generateCatalog($urnDictionary, $ideFilePath);
150+
} else {
151+
throw new InputException(__("Format for IDE '%1' is not supported", $ideName));
152+
}
153+
}
154+
155+
/**
156+
* Get formatter based on format
157+
*
158+
* @param string $format
159+
* @return \Magento\Developer\Model\XmlCatalog\Format\FormatInterface|false
160+
*/
161+
private function getFormatters($format)
162+
{
163+
if (!isset($this->formats[$format])) {
164+
return false;
165+
}
166+
return $this->formats[$format];
167+
}
168+
169+
/**
170+
* Get registered formatter aliases
171+
*
172+
* @return string[]
173+
*/
174+
public function getSupportedFormats()
175+
{
176+
return array_keys($this->formats);
177+
}
178+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Developer\Model\XmlCatalog\Format;
8+
9+
/**
10+
* Interface FormatInterface is implemented by custom URN catalog generators
11+
*/
12+
interface FormatInterface
13+
{
14+
/**
15+
* Generate Catalog of URNs
16+
*
17+
* @param string[] $dictionary
18+
* @param string $configFile absolute path to the file to write the catalog
19+
* @return void
20+
*/
21+
public function generateCatalog(array $dictionary, $configFile);
22+
}

0 commit comments

Comments
 (0)