diff --git a/app/bootstrap.php b/app/bootstrap.php index f51265aee618ef7240fe5f2da9653b992cd1b964..23ab8e404587a2bf2809dced127263764a625b15 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -31,8 +31,15 @@ HTML; require_once __DIR__ . '/autoload.php'; require_once BP . '/app/functions.php'; -if (!empty($_SERVER['MAGE_PROFILER'])) { - \Magento\Framework\Profiler::applyConfig($_SERVER['MAGE_PROFILER'], BP, !empty($_REQUEST['isAjax'])); +if (!empty($_SERVER['MAGE_PROFILER']) + && isset($_SERVER['HTTP_ACCEPT']) + && strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false +) { + \Magento\Framework\Profiler::applyConfig( + $_SERVER['MAGE_PROFILER'], + BP, + !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' + ); } if (ini_get('date.timezone') == '') { date_default_timezone_set('UTC'); diff --git a/app/code/Magento/Catalog/etc/product_options_merged.xsd b/app/code/Magento/Catalog/etc/product_options_merged.xsd index 68268f1d9cd1f5a2a6aa328d74f9c2253063408e..5cf7fcf2fce991e128fcb8f869e50dcbd4e6988a 100644 --- a/app/code/Magento/Catalog/etc/product_options_merged.xsd +++ b/app/code/Magento/Catalog/etc/product_options_merged.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:redefine schemaLocation="product_options.xsd"> + <xs:redefine schemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd"> <xs:complexType name="optionDeclaration"> <xs:complexContent> <xs:restriction base="optionDeclaration"> diff --git a/app/code/Magento/Catalog/etc/product_types.xsd b/app/code/Magento/Catalog/etc/product_types.xsd index 8dc3de773c169ba3f9207f14750bd1f5b7241683..a607244d5e9764bc32363e1a4d747b16a6a8ff7d 100644 --- a/app/code/Magento/Catalog/etc/product_types.xsd +++ b/app/code/Magento/Catalog/etc/product_types.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="product_types_base.xsd" /> + <xs:include schemaLocation="urn:magento:module:Magento_Catalog:etc/product_types_base.xsd" /> <xs:element name="config"> <xs:complexType> diff --git a/app/code/Magento/Catalog/etc/product_types_merged.xsd b/app/code/Magento/Catalog/etc/product_types_merged.xsd index 35958084924344bc3e32142a5f09d0b3c0c35e81..3098817cea101d6b57f72da22fcc414d5731fb99 100644 --- a/app/code/Magento/Catalog/etc/product_types_merged.xsd +++ b/app/code/Magento/Catalog/etc/product_types_merged.xsd @@ -7,7 +7,7 @@ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="product_types_base.xsd" /> + <xs:include schemaLocation="urn:magento:module:Magento_Catalog:etc/product_types_base.xsd" /> <xs:element name="config"> <xs:complexType> diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml index e1bdb4dbcb9be3a0a27e23813425161228673143..4e021bbafe02b271bc11e8554669ca9f4355b70e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">product_listing.product_listing_data_source</item> diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml index a4f0f8c41ec975ac84ec5f1050952e6a73c52e34..944e05f55a651bc5aedf7fd860f3bc15b2d3ab25 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml +++ b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <columns name="product_columns" class="Magento\Catalog\Ui\Component\Listing\Columns"> <column name="qty"> <argument name="data" xsi:type="array"> diff --git a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml index 6775549e39d49d9b1d097c99861a8683b164ab1f..d986cbfef3be1d86fd650368cc26b4e9b9ffe0d0 100644 --- a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml +++ b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">cms_block_listing.cms_block_listing_data_source</item> diff --git a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml index 27cc3ddc2e019535e117e1ba519a48c7264ee7cd..551a0709d2ea7dbf91a5c006b41afbeca7609d2e 100644 --- a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml +++ b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">cms_page_listing.cms_page_listing_data_source</item> diff --git a/app/code/Magento/Config/Observer/Config/Backend/Admin/AfterCustomUrlChangedObserver.php b/app/code/Magento/Config/Observer/Config/Backend/Admin/AfterCustomUrlChangedObserver.php index 36c952ae45722c24245c788b77cf085687d0d657..816984b860b5aecbd15a075dfdfa2e1bb27c58d8 100644 --- a/app/code/Magento/Config/Observer/Config/Backend/Admin/AfterCustomUrlChangedObserver.php +++ b/app/code/Magento/Config/Observer/Config/Backend/Admin/AfterCustomUrlChangedObserver.php @@ -33,38 +33,31 @@ class AfterCustomUrlChangedObserver implements ObserverInterface */ protected $_response; - /** - * @var \Magento\Store\Model\StoreManagerInterface - */ - protected $_storeManager; - /** * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Framework\App\ResponseInterface $response - * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Backend\Helper\Data $backendData, \Magento\Framework\Registry $coreRegistry, \Magento\Backend\Model\Auth\Session $authSession, - \Magento\Framework\App\ResponseInterface $response, - \Magento\Store\Model\StoreManagerInterface $storeManager + \Magento\Framework\App\ResponseInterface $response ) { $this->_backendData = $backendData; $this->_coreRegistry = $coreRegistry; $this->_authSession = $authSession; $this->_response = $response; - $this->_storeManager = $storeManager; } /** - * Log out user and redirect him to new admin custom url + * Log out user and redirect to new admin custom url * * @param \Magento\Framework\Event\Observer $observer * @return void * @SuppressWarnings(PHPMD.ExitExpression) + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function execute(\Magento\Framework\Event\Observer $observer) { @@ -73,10 +66,8 @@ class AfterCustomUrlChangedObserver implements ObserverInterface } $this->_authSession->destroy(); - - $route = $this->_backendData->getAreaFrontName(); - - $this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse(); + $adminUrl = $this->_backendData->getHomePageUrl(); + $this->_response->setRedirect($adminUrl)->sendResponse(); exit(0); } } diff --git a/app/code/Magento/Config/etc/system_include.xsd b/app/code/Magento/Config/etc/system_include.xsd index 2c39b82927d2bb9bf12e848388cf4ee46c911a51..4b36237a673cec2e9e3a1d130f3e1fad508edae2 100644 --- a/app/code/Magento/Config/etc/system_include.xsd +++ b/app/code/Magento/Config/etc/system_include.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="system_file.xsd"/> + <xs:include schemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"/> <xs:element name="include" type="include" /> <xs:complexType name="include"> <xs:group minOccurs="1" maxOccurs="unbounded" ref="insertNodes"/> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml index 7fd14ff394f9bff99203fe4af1ace655faf37472..19aa14654252d6f38422e206ee16ad1f685587a9 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">configurable_associated_product_listing.data_source</item> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml index edf1f8cae1c9ebb9bd8a2ca89a24ebaaa296c5cf..befdbacd705999baea8ed2b44cd38c082f4534e8 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">product_attributes_listing.product_attributes_listing_data_source</item> diff --git a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml index 5c01b2cb6c7b8aced92bd6ddd731325c7abcc3bd..e1a9e9aa7ec2f25dfa1c2b5b3f751ade1b0bc466 100644 --- a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml +++ b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item> diff --git a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml index c864f2ac240f44a160f0420ce22dcbfaee91081f..7a1e66f70ba890950374a631039ab091d9e273d2 100644 --- a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml +++ b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">customer_online_grid.customer_online_grid_data_source</item> diff --git a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml index 0fa2ab59bcc75e9d49a6c72c7475adafefca3332..d03507aba278063c5f83eba42e4e1bcc0433dc56 100644 --- a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml +++ b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">customer_form.customer_form_data_source</item> diff --git a/app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php b/app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..689d408926d0c918cc2af602ed95a9cf19afd805 --- /dev/null +++ b/app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php @@ -0,0 +1,178 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Developer\Console\Command; + +use Magento\Framework\Exception\InputException; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Magento\Framework\App\Filesystem\DirectoryList; + +/** + * Class XmlCatalogGenerateCommand Generates dictionary of URNs for the IDE + * + * @SuppressWarnings(PMD.CouplingBetweenObjects) + */ +class XmlCatalogGenerateCommand extends Command +{ + /** + * Option for the type of IDE + */ + const IDE_OPTION = 'ide'; + + /** + * Argument for the path to IDE config file + */ + const IDE_FILE_PATH_ARGUMENT = 'path'; + + /** + * @var \Magento\Framework\App\Utility\Files + */ + private $filesUtility; + + /** + * @var \Magento\Framework\Config\Dom\UrnResolver + */ + private $urnResolver; + + /** + * @var \Magento\Framework\Filesystem\Directory\ReadInterface + */ + private $rootDirRead; + + /** + * Supported formats + * + * @var \Magento\Developer\Model\XmlCatalog\Format\FormatInterface[] + */ + private $formats; + + /** + * @param \Magento\Framework\App\Utility\Files $filesUtility + * @param \Magento\Framework\Config\Dom\UrnResolver $urnResolver + * @param \Magento\Framework\Filesystem $filesystemFactory + * @param \Magento\Developer\Model\XmlCatalog\Format\FormatInterface[] $formats + */ + public function __construct( + \Magento\Framework\App\Utility\Files $filesUtility, + \Magento\Framework\Config\Dom\UrnResolver $urnResolver, + \Magento\Framework\Filesystem $filesystemFactory, + array $formats = [] + ) { + $this->filesUtility = $filesUtility; + $this->urnResolver = $urnResolver; + $this->formats = $formats; + $this->rootDirRead = $filesystemFactory->getDirectoryRead(DirectoryList::ROOT); + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('dev:urn-catalog:generate') + ->setDescription('Generates the catalog of URNs to *.xsd mappings for the IDE to highlight xml.') + ->setDefinition([ + new InputOption( + self::IDE_OPTION, + null, + InputOption::VALUE_REQUIRED, + 'Format in which catalog will be generated. Supported: ['. + implode(', ', $this->getSupportedFormats()) . ']', + 'phpstorm' + ), + new InputArgument( + self::IDE_FILE_PATH_ARGUMENT, + InputArgument::REQUIRED, + 'Path to file to output the catalog. For PhpStorm use .idea/misc.xml' + ) + ]); + + parent::configure(); + } + + /** + * Get an array of URNs + * + * @param OutputInterface $output + * @return array + */ + private function getUrnDictionary(OutputInterface $output) + { + $files = $this->filesUtility->getXmlCatalogFiles('*.xml'); + $files = array_merge($files, $this->filesUtility->getXmlCatalogFiles('*.xsd')); + + $urns = []; + foreach ($files as $file) { + $content = $this->rootDirRead->readFile( + $this->rootDirRead->getRelativePath($file[0]) + ); + $matches = []; + preg_match_all('/schemaLocation="(urn\:magento\:[^"]*)"/i', $content, $matches); + if (isset($matches[1])) { + $urns = array_merge($urns, $matches[1]); + } + } + $urns = array_unique($urns); + $paths = []; + foreach ($urns as $urn) { + try { + $paths[$urn] = $this->urnResolver->getRealPath($urn); + } catch (\Exception $e) { + // don't add unsupported element to array + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $output->writeln($e->getMessage()); + } + } + } + return $paths; + } + + /** + * {@inheritdoc} + * @throws \InvalidArgumentException + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $ideName = $input->getOption(self::IDE_OPTION); + $ideFilePath = $input->getArgument(self::IDE_FILE_PATH_ARGUMENT); + + $urnDictionary = $this->getUrnDictionary($output); + if ($formatter = $this->getFormatters($ideName)) { + $formatter->generateCatalog($urnDictionary, $ideFilePath); + } else { + throw new InputException(__("Format for IDE '%1' is not supported", $ideName)); + } + } + + /** + * Get formatter based on format + * + * @param string $format + * @return \Magento\Developer\Model\XmlCatalog\Format\FormatInterface|false + */ + private function getFormatters($format) + { + if (!isset($this->formats[$format])) { + return false; + } + return $this->formats[$format]; + } + + /** + * Get registered formatter aliases + * + * @return string[] + */ + public function getSupportedFormats() + { + return array_keys($this->formats); + } +} diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/FormatInterface.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/FormatInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..5a43380cb3a1c892f5a0de9a05e901cc7f52440b --- /dev/null +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/FormatInterface.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Developer\Model\XmlCatalog\Format; + +/** + * Interface FormatInterface is implemented by custom URN catalog generators + */ +interface FormatInterface +{ + /** + * Generate Catalog of URNs + * + * @param string[] $dictionary + * @param string $configFile absolute path to the file to write the catalog + * @return void + */ + public function generateCatalog(array $dictionary, $configFile); +} diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/PhpStorm.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/PhpStorm.php new file mode 100644 index 0000000000000000000000000000000000000000..ee2b8e0cd984cae3b9a721d64b2c21748d7cb4ab --- /dev/null +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/PhpStorm.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Developer\Model\XmlCatalog\Format; + +use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Filesystem\Directory\ReadFactory; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Filesystem\Directory\WriteFactory; +use Magento\Framework\Filesystem\Directory\WriteInterface; + +/** + * Class PhpStorm generates URN catalog for PhpStorm 9 + */ +class PhpStorm implements FormatInterface +{ + /** + * @var ReadInterface + */ + private $currentDirRead; + + /** + * @var \Magento\Framework\Filesystem\File\WriteFactory + */ + private $fileWriteFactory; + + /** + * @param ReadFactory $readFactory + * @param \Magento\Framework\Filesystem\File\WriteFactory $fileWriteFactory + */ + public function __construct( + ReadFactory $readFactory, + \Magento\Framework\Filesystem\File\WriteFactory $fileWriteFactory + ) { + $this->currentDirRead = $readFactory->create(getcwd()); + $this->fileWriteFactory = $fileWriteFactory; + } + + /** + * Generate Catalog of URNs for the PhpStorm 9 + * + * @param string[] $dictionary + * @param string $configFilePath relative path to the PhpStorm misc.xml + * @return void + */ + public function generateCatalog(array $dictionary, $configFilePath) + { + $componentNode = null; + $projectNode = null; + + try { + $file = $this->fileWriteFactory->create( + $configFilePath, + \Magento\Framework\Filesystem\DriverPool::FILE, + 'r' + ); + $dom = new \DOMDocument(); + $dom->loadXML($file->readAll()); + $xpath = new \DOMXPath($dom); + $nodeList = $xpath->query('/project'); + $projectNode = $nodeList->item(0); + $file->close(); + } catch (FileSystemException $f) { + //create file if does not exists + $dom = new \DOMDocument(); + $projectNode = $dom->createElement('project'); + + //PhpStorm 9 version for component is "4" + $projectNode->setAttribute('version', '4'); + $dom->appendChild($projectNode); + $rootComponentNode = $dom->createElement('component'); + + //PhpStorm 9 version for ProjectRootManager is "2" + $rootComponentNode->setAttribute('version', '2'); + $rootComponentNode->setAttribute('name', 'ProjectRootManager'); + $projectNode->appendChild($rootComponentNode); + } + + $xpath = new \DOMXPath($dom); + $nodeList = $xpath->query("/project/component[@name='ProjectResources']"); + $componentNode = $nodeList->item(0); + if ($componentNode == null) { + $componentNode = $dom->createElement('component'); + $componentNode->setAttribute('name', 'ProjectResources'); + $projectNode->appendChild($componentNode); + } + + foreach ($dictionary as $urn => $xsdPath) { + $node = $dom->createElement('resource'); + $node->setAttribute('url', $urn); + $node->setAttribute('location', $xsdPath); + $componentNode->appendChild($node); + } + $dom->formatOutput = true; + $file = $this->fileWriteFactory->create( + $configFilePath, + \Magento\Framework\Filesystem\DriverPool::FILE, + 'w' + ); + $file->write($dom->saveXML()); + $file->close(); + } +} diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c894b93af905027000cd5656555361fd8e3f7628 --- /dev/null +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Developer\Test\Unit\Console\Command; + +use Magento\Developer\Console\Command\XmlCatalogGenerateCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class XmlCatalogGenerateCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var XmlCatalogGenerateCommand + */ + private $command; + + public function testExecuteBadType() + { + $fixtureXmlFile = __DIR__ . '/_files/test.xml'; + + $filesMock = $this->getMock('\Magento\Framework\App\Utility\Files', ['getXmlCatalogFiles'], [], '', false); + $filesMock->expects($this->at(0)) + ->method('getXmlCatalogFiles') + ->will($this->returnValue([[$fixtureXmlFile]])); + $filesMock->expects($this->at(1)) + ->method('getXmlCatalogFiles') + ->will($this->returnValue([])); + $urnResolverMock = $this->getMock('\Magento\Framework\Config\Dom\UrnResolver', [], [], '', false); + $urnResolverMock->expects($this->once()) + ->method('getRealPath') + ->with($this->equalTo('urn:magento:framework:Module/etc/module.xsd')) + ->will($this->returnValue($fixtureXmlFile)); + + $phpstormFormatMock = $this->getMock('\Magento\Developer\Model\XmlCatalog\Format\PhpStorm', [], [], '', false); + $phpstormFormatMock->expects($this->once()) + ->method('generateCatalog') + ->with( + $this->equalTo(['urn:magento:framework:Module/etc/module.xsd' => $fixtureXmlFile]), + $this->equalTo('test') + )->will($this->returnValue(null)); + + $formats = ['phpstorm' => $phpstormFormatMock]; + $filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); + $readDirMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface', [], [], '', false); + + $content = file_get_contents($fixtureXmlFile); + + $readDirMock->expects($this->once()) + ->method('getRelativePath') + ->with($this->equalTo($fixtureXmlFile)) + ->will($this->returnValue('test')); + $readDirMock->expects($this->once()) + ->method('readFile') + ->with($this->equalTo('test')) + ->will($this->returnValue($content)); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->will($this->returnValue($readDirMock)); + + $this->command = new XmlCatalogGenerateCommand( + $filesMock, + $urnResolverMock, + $filesystem, + $formats + ); + + $commandTester = new CommandTester($this->command); + $commandTester->execute([XmlCatalogGenerateCommand::IDE_FILE_PATH_ARGUMENT => 'test']); + $this->assertEquals('', $commandTester->getDisplay()); + } +} diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/_files/test.xml b/app/code/Magento/Developer/Test/Unit/Console/Command/_files/test.xml new file mode 100644 index 0000000000000000000000000000000000000000..f98f1581079dd503f3dded207ce8b983dd543925 --- /dev/null +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/_files/test.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> + <module name="Magento_Cron" setup_version="2.0.0"> + <sequence> + <module name="Magento_Store"/> + </sequence> + </module> +</config> diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml index a393b0ebce8bc9101a6b69f0f3bdacef49235652..2565d9ad705f60df65d666051c97433c9e3fede0 100644 --- a/app/code/Magento/Developer/etc/di.xml +++ b/app/code/Magento/Developer/etc/di.xml @@ -15,6 +15,13 @@ <argument name="pageConfigRendererFactory" xsi:type="object">Magento\Developer\Model\View\Page\Config\RendererFactory</argument> </arguments> </type> + <type name="\Magento\Developer\Console\Command\XmlCatalogGenerateCommand"> + <arguments> + <argument name="formats" xsi:type="array"> + <item name="phpstorm" xsi:type="object">Magento\Developer\Model\XmlCatalog\Format\PhpStorm</item> + </argument> + </arguments> + </type> <type name="Magento\Developer\Model\View\Page\Config\RendererFactory"> <arguments> <argument name="rendererTypes" xsi:type="array"> @@ -88,6 +95,7 @@ <item name="dev_tests_run" xsi:type="object">Magento\Developer\Console\Command\DevTestsRunCommand</item> <item name="dev_source_theme_deploy" xsi:type="object">Magento\Developer\Console\Command\SourceThemeDeployCommand</item> <item name="xml_converter" xsi:type="object">Magento\Developer\Console\Command\XmlConverterCommand</item> + <item name="xml_catalog_generator" xsi:type="object">Magento\Developer\Console\Command\XmlCatalogGenerateCommand</item> </argument> </arguments> </type> diff --git a/app/code/Magento/ImportExport/etc/export_merged.xsd b/app/code/Magento/ImportExport/etc/export_merged.xsd index 6a886e405f7a8028b3ef431612e012005d9b862e..e14fab413e4799ae98596e620977d63a10ca3227 100644 --- a/app/code/Magento/ImportExport/etc/export_merged.xsd +++ b/app/code/Magento/ImportExport/etc/export_merged.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:redefine schemaLocation="export.xsd"> + <xs:redefine schemaLocation="urn:magento:module:Magento_ImportExport:etc/export.xsd"> <xs:complexType name="entityDeclaration"> <xs:complexContent> <xs:restriction base="entityDeclaration"> diff --git a/app/code/Magento/ImportExport/etc/import_merged.xsd b/app/code/Magento/ImportExport/etc/import_merged.xsd index 208e3ba0ed78b863580d83ed70588df982e11785..5b56b9468bf8e009eb235f389d3b5a9d3389a0b7 100644 --- a/app/code/Magento/ImportExport/etc/import_merged.xsd +++ b/app/code/Magento/ImportExport/etc/import_merged.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:redefine schemaLocation="import.xsd"> + <xs:redefine schemaLocation="urn:magento:module:Magento_ImportExport:etc/import.xsd"> <xs:complexType name="entityDeclaration"> <xs:complexContent> <xs:restriction base="entityDeclaration"> diff --git a/app/code/Magento/LayeredNavigation/view/adminhtml/ui_component/product_attributes_listing.xml b/app/code/Magento/LayeredNavigation/view/adminhtml/ui_component/product_attributes_listing.xml index 39cd52f20586c760145b8ef62211037800154c8a..59281daf4f0ff298f5e92697f4ae30875cc5913c 100644 --- a/app/code/Magento/LayeredNavigation/view/adminhtml/ui_component/product_attributes_listing.xml +++ b/app/code/Magento/LayeredNavigation/view/adminhtml/ui_component/product_attributes_listing.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <container name="listing_top"></container> <columns name="product_attributes_columns"> <column name="is_filterable"> diff --git a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php index d86d8df059161ffdf7b0b04bfde642c328a3a02f..fd04f1fe4ca2fbe28854f837b0a3323d70164473 100644 --- a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php +++ b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php @@ -76,11 +76,6 @@ class BuiltinPlugin $this->kernel->process($result); } } else { - json_decode($result->getContent()); - if (json_last_error() == JSON_ERROR_NONE) { - // reset profiler to avoid appending profiling stat to JSON response - \Magento\Framework\Profiler::reset(); - } $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'HIT', true); } return $result; diff --git a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php b/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php index ae38b76db495f0e4fefbc1dd3763516ba55d0ef0..9e4102c889052f63cf2f358577d5059fa7aebc51 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php @@ -200,7 +200,6 @@ class BuiltinPluginTest extends \PHPUnit_Framework_TestCase $this->responseMock->expects($this->never()) ->method('setHeader'); } - $this->responseMock->expects($this->once())->method('getContent'); $this->assertSame( $this->responseMock, $this->plugin->aroundDispatch($this->frontControllerMock, $this->closure, $this->requestMock) diff --git a/app/code/Magento/Sales/etc/pdf_file.xsd b/app/code/Magento/Sales/etc/pdf_file.xsd index 42c5e2cb8112a3b8e062fd5438e8e6c509039010..344d145a27215a4d8eda88e48dce6754b53faeef 100644 --- a/app/code/Magento/Sales/etc/pdf_file.xsd +++ b/app/code/Magento/Sales/etc/pdf_file.xsd @@ -8,7 +8,7 @@ */ --> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:redefine schemaLocation="pdf.xsd"> + <xs:redefine schemaLocation="urn:magento:module:Magento_Sales:etc/pdf.xsd"> <xs:complexType name="totalItemType"> <xs:complexContent> <xs:restriction base="totalItemType"> diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_creditmemo_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_creditmemo_grid.xml index a7f92654a75d0223583291749c5d0dbb5d8a83d7..d3dc8ff9de7769049f304752bad4630a45f27825 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_creditmemo_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_creditmemo_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">sales_order_creditmemo_grid.sales_order_creditmemo_grid_data_source</item> diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml index 6e57da8d260845951285c1c6cedc3b2f6a0f003a..c118bc2f9d76f50b877de259749829931208830c 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">sales_order_grid.sales_order_grid_data_source</item> diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_invoice_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_invoice_grid.xml index 2022ef7f1d5847b84dafdf368c065b0672acfc8c..86e96448e5d2f56a48859084ae69a4e89f5b6ff6 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_invoice_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_invoice_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">sales_order_invoice_grid.sales_order_invoice_grid_data_source</item> diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_shipment_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_shipment_grid.xml index 7fed1927717889996266120fc16e4d31db073391..76db34268b8ac8c968ef672a3ce39f82c239fcec 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_shipment_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_shipment_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">sales_order_shipment_grid.sales_order_shipment_grid_data_source</item> diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml index 4377aefc1b19b007bf3b9922994ba114cbb1add9..458516ec3ce0f8e0d9363cdf138be519b4ef2cef 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">sales_order_view_creditmemo_grid.sales_order_view_creditmemo_grid_data_source</item> diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml index 9ea839d31c23a9dea465d9806109c4e2a2ca6320..e421ca8ac4bcf799ff646422c4875c0e8cc0325f 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">sales_order_view_invoice_grid.sales_order_view_invoice_grid_data_source</item> diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml index 43539e5c20ccba9f758f5daab99fe880cb1c682e..2afc583df2f08b680c1f9b0e93ad75c9d12aef72 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> +<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">sales_order_view_shipment_grid.sales_order_view_shipment_grid_data_source</item> diff --git a/app/code/Magento/Ui/etc/di.xml b/app/code/Magento/Ui/etc/di.xml index 1c59a83b3d54c09352ccf933d5214e51e4771dce..c021e1beddc026638d8d0fad044d2f49f81ec48e 100644 --- a/app/code/Magento/Ui/etc/di.xml +++ b/app/code/Magento/Ui/etc/di.xml @@ -78,7 +78,7 @@ </virtualType> <virtualType name="uiConfigurationDomMerger" type="Magento\Framework\View\Element\UiComponent\Config\DomMerger"> <arguments> - <argument name="schema" xsi:type="string">urn:magento:framework:Ui/etc/ui_configuration.xsd</argument> + <argument name="schema" xsi:type="string">urn:magento:module:Magento_Ui:etc/ui_configuration.xsd</argument> <argument name="contextXPath" xsi:type="array"> <item name="ui_context" xsi:type="string">/</item> </argument> @@ -111,7 +111,7 @@ </type> <virtualType name="uiDefinitionDomMerger" type="Magento\Framework\View\Element\UiComponent\Config\DomMerger"> <arguments> - <argument name="schema" xsi:type="string">urn:magento:framework:Ui/etc/ui_definition.xsd</argument> + <argument name="schema" xsi:type="string">urn:magento:module:Magento_Ui:etc/ui_definition.xsd</argument> <argument name="contextXPath" xsi:type="array"> <item name="ui_context" xsi:type="string">/components</item> </argument> diff --git a/lib/internal/Magento/Framework/Ui/etc/ui_components.xsd b/app/code/Magento/Ui/etc/ui_components.xsd similarity index 99% rename from lib/internal/Magento/Framework/Ui/etc/ui_components.xsd rename to app/code/Magento/Ui/etc/ui_components.xsd index f57cee5918faf2e1492be91f8c4107c82b619da7..dea805fd39bee7af7a149d0636a435f12fa8c9de 100644 --- a/lib/internal/Magento/Framework/Ui/etc/ui_components.xsd +++ b/app/code/Magento/Ui/etc/ui_components.xsd @@ -7,7 +7,7 @@ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <!-- Include section --> - <xs:include schemaLocation="../../Data/etc/argument/types.xsd"/> + <xs:include schemaLocation="urn:magento:framework:Data/etc/argument/types.xsd"/> <!-- Defined the types of components --> <xs:complexType name="layout" xml:base="ui_element"> <xs:complexContent> diff --git a/lib/internal/Magento/Framework/Ui/etc/ui_configuration.xsd b/app/code/Magento/Ui/etc/ui_configuration.xsd similarity index 98% rename from lib/internal/Magento/Framework/Ui/etc/ui_configuration.xsd rename to app/code/Magento/Ui/etc/ui_configuration.xsd index 9cdf10564944662f5ee6cafa29c88c7c3ee28917..2940882abe1da96e8c9ae42d0f3c81fa6ced42bd 100644 --- a/lib/internal/Magento/Framework/Ui/etc/ui_configuration.xsd +++ b/app/code/Magento/Ui/etc/ui_configuration.xsd @@ -11,7 +11,7 @@ <xs:documentation>The definition of a configuration item components</xs:documentation> </xs:annotation> <!-- Include section --> - <xs:include schemaLocation="ui_components.xsd"/> + <xs:include schemaLocation="urn:magento:module:Magento_Ui:etc/ui_components.xsd"/> <!-- Components list --> <xs:element type="formConfiguration" name="form"/> <xs:element type="containerConfiguration" name="container"/> diff --git a/lib/internal/Magento/Framework/Ui/etc/ui_definition.xsd b/app/code/Magento/Ui/etc/ui_definition.xsd similarity index 97% rename from lib/internal/Magento/Framework/Ui/etc/ui_definition.xsd rename to app/code/Magento/Ui/etc/ui_definition.xsd index 78cd48d5f43a23f8cf7cac6ed860108fa330fe3b..e9f16f6f305aca37144eb41be93a2be57e2f6af1 100644 --- a/lib/internal/Magento/Framework/Ui/etc/ui_definition.xsd +++ b/app/code/Magento/Ui/etc/ui_definition.xsd @@ -7,7 +7,7 @@ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <!-- Include section --> - <xs:include schemaLocation="ui_components.xsd"/> + <xs:include schemaLocation="urn:magento:module:Magento_Ui:etc/ui_components.xsd"/> <!-- Definition the document element --> <xs:element name="components" type="definition"/> <!-- Registering components in the system --> diff --git a/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml b/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml index 090c3a9e277a5a1766d28d2dd804c87f44d38311..c722c6b8177400580dd58786f4bdb27497678e2c 100755 --- a/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml +++ b/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<components xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_definition.xsd"> +<components xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_definition.xsd"> <dataSource class="Magento\Ui\Component\DataSource"/> <listing sorting="true" class="Magento\Ui\Component\Listing"> <argument name="data" xsi:type="array"> diff --git a/app/code/Magento/Widget/etc/widget.xsd b/app/code/Magento/Widget/etc/widget.xsd index 7ca6f649aed51faeda120e037d0cc60b8210bdb0..faf08d3afaf8e26ab08ca0c6a05a0b5d58d2120b 100644 --- a/app/code/Magento/Widget/etc/widget.xsd +++ b/app/code/Magento/Widget/etc/widget.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="types.xsd"/> + <xs:include schemaLocation="urn:magento:module:Magento_Widget:etc/types.xsd"/> <xs:annotation> <xs:documentation>Contains widgets.</xs:documentation> diff --git a/app/code/Magento/Widget/etc/widget_file.xsd b/app/code/Magento/Widget/etc/widget_file.xsd index f2f867bb4acf0dd687382123c3856e24f2080aa9..a587a3c2aae45825ea092b4ce58d5ebd8e83c80b 100644 --- a/app/code/Magento/Widget/etc/widget_file.xsd +++ b/app/code/Magento/Widget/etc/widget_file.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="types.xsd"/> + <xs:include schemaLocation="urn:magento:module:Magento_Widget:etc/types.xsd"/> <xs:annotation> <xs:documentation>Contains widgets.</xs:documentation> diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less index 52abcd4c14304192b9586d53cde3e478140191ee..46cbdb5673576e923519e71f7eb6e555daee9c4d 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less @@ -188,7 +188,7 @@ .ui-tabs-panel { // ToDo UI: change the picture to html after loaders refactoring background: url(../images/ajax-loader-small.gif) no-repeat 50% 50%; - min-height: 6rem; + min-height: 4.5rem; } .tabs-horiz { diff --git a/app/design/frontend/Magento/blank/web/css/source/_extends.less b/app/design/frontend/Magento/blank/web/css/source/_extends.less index acdda0c0c8bdfd0c4a2438895143da5b473a06e3..57e4c920babdf7636738ddab9b31f4b74a93a119 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_extends.less +++ b/app/design/frontend/Magento/blank/web/css/source/_extends.less @@ -1128,6 +1128,7 @@ .amount { padding-right: 4px; text-align: right; + white-space: nowrap; strong { font-weight: @font-weight__regular; } diff --git a/app/design/frontend/Magento/luma/web/css/source/_extends.less b/app/design/frontend/Magento/luma/web/css/source/_extends.less index c72a66b87cb2ea02cc059a318fba550e70c95a2b..fcf82fd8c81829a309d9fdedf6c6e7a67641036d 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_extends.less +++ b/app/design/frontend/Magento/luma/web/css/source/_extends.less @@ -1519,6 +1519,7 @@ font-weight: @font-weight__regular; padding: 6px 0 6px 14px; text-align: right; + white-space: nowrap; } } .table-caption { diff --git a/dev/tests/functional/lib/Magento/Mtf/App/State/AbstractState.php b/dev/tests/functional/lib/Magento/Mtf/App/State/AbstractState.php index de6160134035bb11f3f643fb25fcec5d8876224a..6a7827490ceb3675684a16aef28f6d90f8d41413 100644 --- a/dev/tests/functional/lib/Magento/Mtf/App/State/AbstractState.php +++ b/dev/tests/functional/lib/Magento/Mtf/App/State/AbstractState.php @@ -47,7 +47,10 @@ abstract class AbstractState implements StateInterface $configFilePool = \Magento\Mtf\ObjectManagerFactory::getObjectManager() ->get('\Magento\Framework\Config\File\ConfigFilePool'); - $reader = new Reader($dirList, $configFilePool); + $driverPool = \Magento\Mtf\ObjectManagerFactory::getObjectManager() + ->get('\Magento\Framework\Filesystem\DriverPool'); + + $reader = new Reader($dirList, $driverPool, $configFilePool); $deploymentConfig = new DeploymentConfig($reader); $host = $deploymentConfig->get( ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT . '/' . ConfigOptionsListConstants::KEY_HOST diff --git a/dev/tests/integration/etc/install-config-mysql.travis.php.dist b/dev/tests/integration/etc/install-config-mysql.travis.php.dist index ac8eeb0bbbaccc5b2604d3a0e925c384afec1049..1359c82a334bd91bb52f44a0e03cf41b5f10d911 100644 --- a/dev/tests/integration/etc/install-config-mysql.travis.php.dist +++ b/dev/tests/integration/etc/install-config-mysql.travis.php.dist @@ -9,7 +9,7 @@ return [ 'db-user' => 'travis', 'db-password' => '', 'db-name' => 'magento_integration_tests', - 'db-prefix' => 'travis_', + 'db-prefix' => 'trv_', 'backend-frontname' => 'backend', 'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 966451fb35855c784a9533829fd319e7ad659082..769876f7e38a2b87b8e9cb07eab06a66449f215d 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -190,7 +190,8 @@ class Application if (null === $this->_db) { if ($this->isInstalled()) { $configPool = new \Magento\Framework\Config\File\ConfigFilePool(); - $reader = new Reader($this->dirList, $configPool); + $driverPool = new \Magento\Framework\Filesystem\DriverPool(); + $reader = new Reader($this->dirList, $driverPool, $configPool); $deploymentConfig = new DeploymentConfig($reader, []); $host = $deploymentConfig->get( ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT . diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php index 2ca967abca40e8238166a75dc7ff18302b9b25cb..e6e430d1e3e3572baa6a84efceca22bdedf4ef4b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php @@ -105,6 +105,21 @@ class FilesTest extends \PHPUnit_Framework_TestCase } } + public function testGetXmlCatalogFiles() + { + $actual = $this->model->getXmlCatalogFiles('*.xml'); + $this->assertNotEmpty($actual); + foreach ($actual as $file) { + $this->assertStringEndsWith('.xml', $file[0]); + } + + $actual = $this->model->getXmlCatalogFiles('*.xsd'); + $this->assertNotEmpty($actual); + foreach ($actual as $file) { + $this->assertStringEndsWith('.xsd', $file[0]); + } + } + /** * Verify that the given array of files does not contain anything in test directories * diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig.php b/lib/internal/Magento/Framework/App/DeploymentConfig.php index ef1710741d222ed783e2312e72b678780a2f9cd7..06784e31d2d74cbc2abff0223cea62c75dba2580 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig.php @@ -6,6 +6,8 @@ namespace Magento\Framework\App; +use Magento\Framework\Config\ConfigOptionsListConstants; + /** * Application deployment configuration */ @@ -39,13 +41,6 @@ class DeploymentConfig */ private $overrideData; - /** - * Availability of deployment config file - * - * @var bool - */ - private $isAvailable; - /** * Constructor * @@ -65,7 +60,7 @@ class DeploymentConfig * * @param string $key * @param mixed $defaultValue - * @return array|null + * @return mixed|null */ public function get($key = null, $defaultValue = null) { @@ -85,7 +80,7 @@ class DeploymentConfig { $this->data = null; $this->load(); - return $this->isAvailable; + return isset($this->flatData[ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE]); } /** @@ -128,7 +123,6 @@ class DeploymentConfig { if (null === $this->data) { $this->data = $this->reader->load(); - $this->isAvailable = !empty($this->data); if ($this->overrideData) { $this->data = array_replace($this->data, $this->overrideData); } diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php index 5ccb6c347c6fd8effb20e8a36954ed75ffe793c7..1654f98ead05502a214b5f42dac6cb825c180644 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php @@ -8,6 +8,7 @@ namespace Magento\Framework\App\DeploymentConfig; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Config\File\ConfigFilePool; +use Magento\Framework\Filesystem\DriverPool; /** * Deployment configuration reader @@ -24,6 +25,11 @@ class Reader */ private $configFilePool; + /** + * @var DriverPool + */ + private $driverPool; + /** * Configuration file names * @@ -35,14 +41,20 @@ class Reader * Constructor * * @param DirectoryList $dirList + * @param DriverPool $driverPool * @param ConfigFilePool $configFilePool * @param null|string $file * @throws \InvalidArgumentException */ - public function __construct(DirectoryList $dirList, ConfigFilePool $configFilePool, $file = null) - { + public function __construct( + DirectoryList $dirList, + DriverPool $driverPool, + ConfigFilePool $configFilePool, + $file = null + ) { $this->dirList = $dirList; $this->configFilePool = $configFilePool; + $this->driverPool = $driverPool; if (null !== $file) { if (!preg_match('/^[a-z\d\.\-]+\.php$/i', $file)) { throw new \InvalidArgumentException("Invalid file name: {$file}"); @@ -73,23 +85,32 @@ class Reader public function load($fileKey = null) { $path = $this->dirList->getPath(DirectoryList::CONFIG); + $fileDriver = $this->driverPool->getDriver(DriverPool::FILE); + $result = []; if ($fileKey) { - $result = @include $path . '/' . $this->configFilePool->getPath($fileKey); + $filePath = $path . '/' . $this->configFilePool->getPath($fileKey); + if ($fileDriver->isExists($filePath)) { + $result = include $filePath; + } } else { $configFiles = $this->configFilePool->getPaths(); + $allFilesData = []; $result = []; foreach (array_keys($configFiles) as $fileKey) { $configFile = $path . '/' . $this->configFilePool->getPath($fileKey); - $fileData = @include $configFile; + if ($fileDriver->isExists($configFile)) { + $fileData = include $configFile; + } else { + continue; + } + $allFilesData[$configFile] = $fileData; if (!empty($fileData)) { $intersection = array_intersect_key($result, $fileData); if (!empty($intersection)) { - $displayList = ''; - foreach (array_keys($intersection) as $key) { - $displayList .= $key . PHP_EOL; - } + $displayMessage = $this->findFilesWithKeys(array_keys($intersection), $allFilesData); throw new \Exception( - "Key collision! The following keys occur in multiple config files:" . PHP_EOL . $displayList + "Key collision! The following keys occur in multiple config files:" + . PHP_EOL . $displayMessage ); } $result = array_merge($result, $fileData); @@ -98,4 +119,26 @@ class Reader } return $result ?: []; } + + /** + * Finds list of files that has the key + * + * @param array $keys + * @param array $allFilesData + * @return string + */ + private function findFilesWithKeys(array $keys, array $allFilesData) + { + $displayMessage = ''; + foreach ($keys as $key) { + $foundConfigFiles = []; + foreach ($allFilesData as $fileName => $fileValues) { + if (isset($fileValues[$key])) { + $foundConfigFiles[] = $fileName; + } + } + $displayMessage .= 'Key "' . $key . '" found in ' . implode(', ', $foundConfigFiles) . PHP_EOL; + } + return $displayMessage; + } } diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index 742221429db1bb039cf2e4a20811b898ab833e8b..0d482bf1599dd334bc15bffd0a5cfe7f42b6167d 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -202,7 +202,7 @@ class ObjectManagerFactory $customData = isset($arguments[self::INIT_PARAM_DEPLOYMENT_CONFIG]) ? $arguments[self::INIT_PARAM_DEPLOYMENT_CONFIG] : []; - $reader = new DeploymentConfig\Reader($directoryList, $configFilePool, $customFile); + $reader = new DeploymentConfig\Reader($directoryList, $this->driverPool, $configFilePool, $customFile); return new DeploymentConfig($reader, $customData); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php index 04437a742a5f093204fe805629280f8130a23d2a..0afa1dca5c3b2c72ba0a75ad993bd6241ea1e234 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php @@ -16,6 +16,16 @@ class ReaderTest extends \PHPUnit_Framework_TestCase */ private $dirList; + /** + * @var \Magento\Framework\Filesystem\DriverPool|\PHPUnit_Framework_MockObject_MockObject + */ + private $driverPool; + + /** + * @var \Magento\Framework\Filesystem\Driver\File|\PHPUnit_Framework_MockObject_MockObject + */ + private $fileDriver; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -28,6 +38,24 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->method('getPath') ->with(DirectoryList::CONFIG) ->willReturn(__DIR__ . '/_files'); + $this->fileDriver = $this->getMock('\Magento\Framework\Filesystem\Driver\File', [], [], '', false); + $this->fileDriver + ->expects($this->any()) + ->method('isExists') + ->will($this->returnValueMap([ + [__DIR__ . '/_files/config.php', true], + [__DIR__ . '/_files/custom.php', true], + [__DIR__ . '/_files/duplicateConfig.php', true], + [__DIR__ . '/_files/env.php', true], + [__DIR__ . '/_files/mergeOne.php', true], + [__DIR__ . '/_files/mergeTwo.php', true], + [__DIR__ . '/_files/nonexistent.php', false] + ])); + $this->driverPool = $this->getMock('\Magento\Framework\Filesystem\DriverPool', [], [], '', false); + $this->driverPool + ->expects($this->any()) + ->method('getDriver') + ->willReturn($this->fileDriver); $this->configFilePool = $this->getMock('Magento\Framework\Config\File\ConfigFilePool', [], [], '', false); $this->configFilePool ->expects($this->any()) @@ -37,11 +65,11 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testGetFile() { - $object = new Reader($this->dirList, $this->configFilePool); + $object = new Reader($this->dirList, $this->driverPool, $this->configFilePool); $files = $object->getFiles(); $this->assertArrayHasKey('configKeyOne', $files); $this->assertArrayHasKey('configKeyTwo', $files); - $object = new Reader($this->dirList, $this->configFilePool, 'customOne.php'); + $object = new Reader($this->dirList, $this->driverPool, $this->configFilePool, 'customOne.php'); $this->assertEquals(['customOne.php'], $object->getFiles()); } @@ -51,7 +79,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase */ public function testWrongFile() { - new Reader($this->dirList, $this->configFilePool, 'invalid_name'); + new Reader($this->dirList, $this->driverPool, $this->configFilePool, 'invalid_name'); } public function testLoad() @@ -61,7 +89,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->expects($this->any()) ->method('getPath') ->will($this->returnValueMap($files)); - $object = new Reader($this->dirList, $this->configFilePool); + $object = new Reader($this->dirList, $this->driverPool, $this->configFilePool); $this->assertSame(['fooKey' =>'foo', 'barKey' => 'bar', 'envKey' => 'env'], $object->load()); } @@ -75,7 +103,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $configFilePool = $this->getMock('Magento\Framework\Config\File\ConfigFilePool', [], [], '', false); $configFilePool->expects($this->any())->method('getPaths')->willReturn([$file]); $configFilePool->expects($this->any())->method('getPath')->willReturn($file); - $object = new Reader($this->dirList, $configFilePool, $file); + $object = new Reader($this->dirList, $this->driverPool, $configFilePool, $file); $this->assertSame($expected, $object->load($file)); } @@ -106,7 +134,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->expects($this->any()) ->method('getPaths') ->willReturn(['configKeyOne' => 'mergeOne.php', 'configKeyTwo' => 'mergeTwo.php']); - $object = new Reader($this->dirList, $configFilePool); + $object = new Reader($this->dirList, $this->driverPool, $configFilePool); $object->load(); } @@ -126,7 +154,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->expects($this->any()) ->method('getPaths') ->willReturn(['configKeyOne' => 'config.php', 'configKeyTwo' => 'duplicateConfig.php']); - $object = new Reader($this->dirList, $configFilePool); + $object = new Reader($this->dirList, $this->driverPool, $configFilePool); $object->load(); } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php index 913844757a6d08837f167ac7d05506c33763c04d..59510f35918d7d0f41cb3a6b3168b9c16a9c9f43 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php @@ -7,6 +7,7 @@ namespace Magento\Framework\App\Test\Unit; use \Magento\Framework\App\DeploymentConfig; +use \Magento\Framework\Config\ConfigOptionsListConstants; class DeploymentConfigTest extends \PHPUnit_Framework_TestCase { @@ -88,7 +89,9 @@ class DeploymentConfigTest extends \PHPUnit_Framework_TestCase public function testIsAvailable() { - $this->reader->expects($this->once())->method('load')->willReturn(['a' => 1]); + $this->reader->expects($this->once())->method('load')->willReturn([ + ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1 + ]); $object = new DeploymentConfig($this->reader); $this->assertTrue($object->isAvailable()); } @@ -103,7 +106,9 @@ class DeploymentConfigTest extends \PHPUnit_Framework_TestCase public function testNotAvailableThenAvailable() { $this->reader->expects($this->at(0))->method('load')->willReturn([]); - $this->reader->expects($this->at(1))->method('load')->willReturn(['a' => 1]); + $this->reader->expects($this->at(1))->method('load')->willReturn([ + ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1 + ]); $object = new DeploymentConfig($this->reader); $this->assertFalse($object->isAvailable()); $this->assertTrue($object->isAvailable()); diff --git a/lib/internal/Magento/Framework/App/Utility/Files.php b/lib/internal/Magento/Framework/App/Utility/Files.php index 7802320f6fc32b2bf77b106237f35ddde8699f43..79891dc76929679574d1f6a59339ca52f8998100 100644 --- a/lib/internal/Magento/Framework/App/Utility/Files.php +++ b/lib/internal/Magento/Framework/App/Utility/Files.php @@ -393,6 +393,61 @@ class Files } // @codingStandardsIgnoreEnd + /** + * Returns list of XML related files, used by Magento application + * + * @param string $fileNamePattern + * @param array $excludedFileNames + * @param bool $asDataSet + * @return array + */ + public function getXmlCatalogFiles( + $fileNamePattern = '*.xsd', + $excludedFileNames = [], + $asDataSet = true + ) { + $cacheKey = __METHOD__ . '|' . BP . '|' . serialize(func_get_args()); + if (!isset(self::$_cache[$cacheKey])) { + $files = $this->getFilesSubset( + $this->componentRegistrar->getPaths(ComponentRegistrar::MODULE), + $fileNamePattern, + [] + ); + $libraryExcludeDirs = []; + foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::LIBRARY) as $libraryDir) { + $libraryExcludeDirs[] = str_replace('\\', '/', '#' . $libraryDir . '/Test#'); + $libraryExcludeDirs[] = str_replace('\\', '/', '#' . $libraryDir) . '/[\\w]+/Test#'; + } + $files = array_merge( + $files, + $this->getFilesSubset( + $this->componentRegistrar->getPaths(ComponentRegistrar::LIBRARY), + $fileNamePattern, + $libraryExcludeDirs + ) + ); + $files = array_merge( + $files, + $this->getFilesSubset( + $this->componentRegistrar->getPaths(ComponentRegistrar::THEME), + $fileNamePattern, + [] + ) + ); + $files = array_filter( + $files, + function ($file) use ($excludedFileNames) { + return !in_array(basename($file), $excludedFileNames); + } + ); + self::$_cache[$cacheKey] = $files; + } + if ($asDataSet) { + return self::composeDataSets(self::$_cache[$cacheKey]); + } + return self::$_cache[$cacheKey]; + } + /** * Returns a list of configuration files found under theme directories. * diff --git a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php index c2c928b2376efe8589e86741e5fa8d3df1c4966b..44258c7f135ce0e122f3a63d6f0fe1fd26737fe4 100644 --- a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php +++ b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php @@ -48,7 +48,7 @@ class ComponentRegistrar implements ComponentRegistrarInterface if (isset(self::$paths[$type][$componentName])) { throw new \LogicException('\'' . $componentName . '\' component already exists'); } else { - self::$paths[$type][$componentName] = $path; + self::$paths[$type][$componentName] = str_replace('\\', '/', $path); } } diff --git a/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php b/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php index 4fbeaecc85d18ad7c22f386ecfd00d838d5b904d..c49d92ee281ce439e2cd948ed3df606624f9a525 100644 --- a/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php +++ b/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php @@ -56,7 +56,6 @@ class ConfigOptionsListConstants */ const SESSION_SAVE_FILES = 'files'; const SESSION_SAVE_DB = 'db'; - const SESSION_SAVE_REDIS = 'redis'; /**#@-*/ /** diff --git a/lib/internal/Magento/Framework/Config/Dom.php b/lib/internal/Magento/Framework/Config/Dom.php index eddf5c5bd8bb2b6dee271d5c900d8e0f199891d4..a0fbe07e087bde32a322761f365e36b31de71a84 100644 --- a/lib/internal/Magento/Framework/Config/Dom.php +++ b/lib/internal/Magento/Framework/Config/Dom.php @@ -281,6 +281,7 @@ class Dom } $schema = self::$urnResolver->getRealPath($schema); libxml_use_internal_errors(true); + libxml_set_external_entity_loader([self::$urnResolver, 'registerEntityLoader']); try { $result = $dom->schemaValidate($schema); $errors = []; @@ -298,6 +299,7 @@ class Dom libxml_use_internal_errors(false); throw $exception; } + libxml_set_external_entity_loader(null); libxml_use_internal_errors(false); return $errors; } diff --git a/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php b/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php index e81a99ea53fec6354e4fdf962f26e64bb5ab0281..4bc62504d253c9c09113c81883e775e69b6aaaed 100644 --- a/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php +++ b/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php @@ -10,6 +10,9 @@ namespace Magento\Framework\Config\Dom; use Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NotFoundException; +use Magento\Framework\Phrase; class UrnResolver { @@ -18,42 +21,60 @@ class UrnResolver * * @param string $schema * @return string - * @throws \UnexpectedValueException + * @throws NotFoundException */ public function getRealPath($schema) { + if (strpos($schema, 'urn:') !== 0) { + return $schema; + } + $componentRegistrar = new ComponentRegistrar(); - if (substr($schema, 0, 4) == 'urn:') { - // resolve schema location - $urnParts = explode(':', $schema); - if ($urnParts[2] == 'module') { - // urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd - // 0 : urn, 1: magento, 2: module, 3: Magento_Catalog, 4: etc/catalog_attributes.xsd - // moduleName -> Magento_Catalog - $schemaPath = $componentRegistrar->getPath( - ComponentRegistrar::MODULE, - $urnParts[3] - ) . '/' . $urnParts[4]; - } else if (strpos($urnParts[2], 'framework') === 0) { - // urn:magento:framework:Module/etc/module.xsd - // 0: urn, 1: magento, 2: framework, 3: Module/etc/module.xsd - // libaryName -> magento/framework - $libraryName = $urnParts[1] . '/' . $urnParts[2]; - $schemaPath = $componentRegistrar->getPath( - ComponentRegistrar::LIBRARY, - $libraryName - ) . '/' . $urnParts[3]; - } else { - throw new \UnexpectedValueException("Unsupported format of schema location: " . $schema); - } - if (!empty($schemaPath) && file_exists($schemaPath)) { - $schema = $schemaPath; + $matches = []; + $modulePattern = '/urn:(?<vendor>([a-zA-Z]*)):module:(?<module>([A-Za-z\_]*)):(?<path>(.+))/'; + $frameworkPattern = '/urn:(?<vendor>([a-zA-Z]*)):(?<framework>(framework[A-Za-z\-]*)):(?<path>(.+))/'; + if (preg_match($modulePattern, $schema, $matches)) { + //urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd + $package = $componentRegistrar + ->getPath(ComponentRegistrar::MODULE, $matches['module']); + } else if (preg_match($frameworkPattern, $schema, $matches)) { + //urn:magento:framework:Module/etc/module.xsd + //urn:magento:framework-amqp:Module/etc/module.xsd + $package = $componentRegistrar + ->getPath(ComponentRegistrar::LIBRARY, $matches['vendor'] . '/' . $matches['framework']); + } else { + throw new NotFoundException(new Phrase("Unsupported format of schema location: '%1'", [$schema])); + } + $schemaPath = $package . '/' . $matches['path']; + if (empty($package) || !file_exists($schemaPath)) { + throw new NotFoundException( + new Phrase("Could not locate schema: '%1' at '%2'", [$schema, $schemaPath]) + ); + } + return $schemaPath; + } + + /** + * Callback registered for libxml to resolve URN to the file path + * + * @param string $public + * @param string $system + * @param array $context + * @return resource + * @throws LocalizedException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function registerEntityLoader($public, $system, $context) + { + if (strpos($system, 'urn:') === 0) { + $filePath = $this->getRealPath($system); + } else { + if (file_exists($system)) { + $filePath = $system; } else { - throw new \UnexpectedValueException( - "Could not locate schema: '" . $schema . "' at '" . $schemaPath . "'" - ); + throw new LocalizedException(new Phrase("File '%system' cannot be found", ['system' => $system])); } } - return $schema; + return fopen($filePath, "r"); } } diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php index 6d78174e755739cafce02fbcfb81c3f7ce8aadfc..4cff9c9cc6156c962394e2f78ccb0ec25b7786be 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Config\Test\Unit\Dom; -use \Magento\Framework\Config\Dom\UrnResolver; +use Magento\Framework\Config\Dom\UrnResolver; use Magento\Framework\Component\ComponentRegistrar; class UrnResolverTest extends \PHPUnit_Framework_TestCase @@ -53,8 +53,8 @@ class UrnResolverTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \UnexpectedValueException - * @expectedExceptionMessage Unsupported format of schema location: urn:magento:test:test:etc/test_test.xsd + * @expectedException \Magento\Framework\Exception\NotFoundException + * @expectedExceptionMessage Unsupported format of schema location: 'urn:magento:test:test:etc/test_test.xsd' */ public function testGetRealPathWrongSection() { @@ -63,7 +63,7 @@ class UrnResolverTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \UnexpectedValueException + * @expectedException \Magento\Framework\Exception\NotFoundException * @expectedExceptionMessage Could not locate schema: 'urn:magento:module:Magento_Test:test.xsd' at '/test.xsd' */ public function testGetRealPathWrongModule() diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index bc3855448ccc264e16b34f061518a3e0507998cd..f1d480efec72e9ec8b610e4209bb581cbf1cb773 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -63,8 +63,6 @@ class Json extends AbstractResult */ protected function render(ResponseInterface $response) { - // reset profiler to avoid appending profiling stat to JSON response - \Magento\Framework\Profiler::reset(); $this->translateInline->processResponseBody($this->json, true); $response->representJson($this->json); return $this; diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_schema.xsd b/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_schema.xsd index 376f73561e6f27ed9953feb1b9384654c415b61d..45abbf27aa5bd0ead250f39f0eccd50edf061ca8 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_schema.xsd +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_schema.xsd @@ -9,6 +9,6 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="../../../../etc/argument/types.xsd"/> + <xs:include schemaLocation="urn:magento:framework:Data/etc/argument/types.xsd"/> <xs:element name="arguments" type="argumentsType"/> </xs:schema> diff --git a/lib/internal/Magento/Framework/Module/ModuleList.php b/lib/internal/Magento/Framework/Module/ModuleList.php index c5fa5ed8a3d10138df6a1c9f7ea3d5a898226c65..fb1fb8de06d17410724097d94d1350ff0078e5ff 100644 --- a/lib/internal/Magento/Framework/Module/ModuleList.php +++ b/lib/internal/Magento/Framework/Module/ModuleList.php @@ -139,7 +139,8 @@ class ModuleList implements ModuleListInterface */ private function loadConfigData() { - if (null === $this->configData && ($this->config->isAvailable())) { + $this->config->resetData(); + if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) { $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES); } } diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php index d4f1af7fa8a07a52fdca9946cb6261bc6a95a799..7f78420c4fc995478cfe02e7e594758dee9e76c9 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php @@ -47,7 +47,7 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase public function testGetAll() { - $this->config->expects($this->once())->method('isAvailable')->willReturn(true); + $this->config->expects($this->exactly(2))->method('resetData'); $this->setLoadAllExpectation(); $this->setLoadConfigExpectation(); $expected = ['foo' => self::$allFixture['foo']]; @@ -58,7 +58,6 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase public function testGetAllNoData() { $this->loader->expects($this->exactly(2))->method('load')->willReturn([]); - $this->config->expects($this->never())->method('isAvailable'); $this->setLoadConfigExpectation(false); $this->assertEquals([], $this->model->getAll()); $this->assertEquals([], $this->model->getAll()); @@ -66,7 +65,7 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase public function testGetOne() { - $this->config->expects($this->once())->method('isAvailable')->willReturn(true); + $this->config->expects($this->exactly(2))->method('resetData'); $this->setLoadAllExpectation(); $this->setLoadConfigExpectation(); $this->assertSame(['key' => 'value'], $this->model->getOne('foo')); @@ -75,7 +74,7 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase public function testGetNames() { - $this->config->expects($this->once())->method('isAvailable')->willReturn(true); + $this->config->expects($this->exactly(2))->method('resetData'); $this->setLoadAllExpectation(false); $this->setLoadConfigExpectation(); $this->assertSame(['foo'], $this->model->getNames()); @@ -84,7 +83,7 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase public function testHas() { - $this->config->expects($this->once())->method('isAvailable')->willReturn(true); + $this->config->expects($this->exactly(2))->method('resetData'); $this->setLoadAllExpectation(false); $this->setLoadConfigExpectation(); $this->assertTrue($this->model->has('foo')); @@ -93,15 +92,15 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase public function testIsModuleInfoAvailable() { - $this->config->expects($this->once())->method('isAvailable')->willReturn(true); + $this->config->expects($this->once())->method('resetData'); $this->setLoadConfigExpectation(true); $this->assertTrue($this->model->isModuleInfoAvailable()); } public function testIsModuleInfoAvailableNoConfig() { - $this->config->expects($this->once())->method('isAvailable')->willReturn(true); - $this->config->expects($this->once())->method('get')->willReturn(null); + $this->config->expects($this->at(0))->method('get')->willReturn(['modules' => 'testModule']); + $this->config->expects($this->at(1))->method('get')->willReturn(null); $this->assertFalse($this->model->isModuleInfoAvailable()); } @@ -114,7 +113,7 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase private function setLoadConfigExpectation($isExpected = true) { if ($isExpected) { - $this->config->expects($this->once())->method('get')->willReturn(self::$enabledFixture); + $this->config->expects($this->exactly(2))->method('get')->willReturn(self::$enabledFixture); } else { $this->config->expects($this->never())->method('get'); } diff --git a/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd b/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd index 2d47cdf0ba1ae5a030c6c2b859247408a0f2320f..3b1f32f40a004cc5d5f50f41ce5242923a8ba579 100644 --- a/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd +++ b/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd @@ -9,7 +9,7 @@ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:redefine schemaLocation="../../Data/etc/argument/types.xsd"> + <xs:redefine schemaLocation="urn:magento:framework:Data/etc/argument/types.xsd"> <xs:complexType name="argumentType" abstract="true" mixed="false"> <xs:complexContent> <xs:extension base="argumentType" /> diff --git a/lib/internal/Magento/Framework/Search/etc/search_request.xsd b/lib/internal/Magento/Framework/Search/etc/search_request.xsd index 9a3d756e0f9b93015ac5c7da2a735e2ac585becb..5b12665d43861d9ec21890bb853bbc021da4a48f 100644 --- a/lib/internal/Magento/Framework/Search/etc/search_request.xsd +++ b/lib/internal/Magento/Framework/Search/etc/search_request.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"> - <xs:include schemaLocation="requests.xsd"/> + <xs:include schemaLocation="urn:magento:framework:Search/etc/requests.xsd"/> <xs:complexType name="requests"> <xs:sequence> diff --git a/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd b/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd index 9e20a45383848f6999cc689b27053aa47f742203..31a5ad3494dfa55bfb9222a29c46745a58e2dbc2 100644 --- a/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd +++ b/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"> - <xs:include schemaLocation="requests.xsd"/> + <xs:include schemaLocation="urn:magento:framework:Search/etc/requests.xsd"/> <xs:complexType name="requests"> <xs:sequence> <xs:element type="request" name="request" maxOccurs="unbounded"> diff --git a/lib/internal/Magento/Framework/Ui/README.md b/lib/internal/Magento/Framework/Ui/README.md deleted file mode 100644 index f955cbb0d9efdd8d91962bd4a79a19387da78397..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Ui/README.md +++ /dev/null @@ -1 +0,0 @@ -Library contain schema files used to validate XML files in Magento\Ui module diff --git a/lib/internal/Magento/Framework/View/Layout/etc/body.xsd b/lib/internal/Magento/Framework/View/Layout/etc/body.xsd index 94922875f16a26c6841363b351c31f0e30466221..d9e83a41bf746d99bae2df172c3fe58982c2576e 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/body.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/body.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="elements.xsd"/> + <xs:include schemaLocation="urn:magento:framework:View/Layout/etc/elements.xsd"/> <xs:complexType name="bodyType"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> diff --git a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd index 2170a38073384fb8f0c0d9f6ad5266fd9d9f63e9..5bc3bfb488ebc1f8a0dc688cd48a459304d77bfa 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:redefine schemaLocation="../../../Data/etc/argument/types.xsd"> + <xs:redefine schemaLocation="urn:magento:framework:Data/etc/argument/types.xsd"> <xs:complexType name="argumentType" abstract="true" mixed="true"> <xs:complexContent> <xs:extension base="argumentType"> diff --git a/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd b/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd index b6ea0390d953df89321b78215de0828368bdf24d..d768b859455825440b945cc192bb5530cdbf22c7 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="elements.xsd"/> + <xs:include schemaLocation="urn:magento:framework:View/Layout/etc/elements.xsd"/> <xs:complexType name="genericLayout"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> diff --git a/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd b/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd index 985c08c630bf959b40f07c66294976bba2102886..d47f45d49f73f4cb277246b03ede3525b6708581 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="elements.xsd"/> + <xs:include schemaLocation="urn:magento:framework:View/Layout/etc/elements.xsd"/> <xs:element name="layout"> <xs:annotation> diff --git a/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd b/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd index 690771f1ddafc8dce67cdbab7a82a3e5a15325a1..a3ff191d37f508b6a08ea5342c503636b83099fb 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd @@ -6,9 +6,9 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="head.xsd"/> - <xs:include schemaLocation="body.xsd"/> - <xs:include schemaLocation="html.xsd"/> + <xs:include schemaLocation="urn:magento:framework:View/Layout/etc/head.xsd"/> + <xs:include schemaLocation="urn:magento:framework:View/Layout/etc/body.xsd"/> + <xs:include schemaLocation="urn:magento:framework:View/Layout/etc/html.xsd"/> <xs:complexType name="pageType"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> diff --git a/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd b/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd index d0012ffbd0f507737b0f050108303bd18505d041..8231cc7778739c2634c8776cda58b17ed006bde2 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd @@ -6,7 +6,7 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="elements.xsd"/> + <xs:include schemaLocation="urn:magento:framework:View/Layout/etc/elements.xsd"/> <xs:complexType name="pageLayoutType"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> diff --git a/setup/pub/magento/setup/web-configuration.js b/setup/pub/magento/setup/web-configuration.js index 13ff2e05fe666c6a6bd90e62eb5e632f5bf83def..9180a727ff20950d1c8b4f37ea56e55e8437d867 100644 --- a/setup/pub/magento/setup/web-configuration.js +++ b/setup/pub/magento/setup/web-configuration.js @@ -27,6 +27,10 @@ angular.module('web-configuration', ['ngStorage']) }, advanced: { expanded: false + }, + sessionSave: { + type: 'files', + error: false } }; diff --git a/setup/src/Magento/Setup/Controller/Install.php b/setup/src/Magento/Setup/Controller/Install.php index fe6f1f363bb7d7b6c4e0109d6870f787a4b1dc23..7a0826acc0472e51c939f09dbd7e9daa6ecc9c56 100644 --- a/setup/src/Magento/Setup/Controller/Install.php +++ b/setup/src/Magento/Setup/Controller/Install.php @@ -162,6 +162,8 @@ class Install extends AbstractActionController ? $source['config']['address']['admin'] : ''; $result[SetupConfigOptionsList::INPUT_KEY_ENCRYPTION_KEY] = isset($source['config']['encrypt']['key']) ? $source['config']['encrypt']['key'] : null; + $result[SetupConfigOptionsList::INPUT_KEY_SESSION_SAVE] = isset($source['config']['sessionSave']['type']) + ? $source['config']['sessionSave']['type'] : SetupConfigOptionsList::SESSION_SAVE_FILES; $result[Installer::ENABLE_MODULES] = isset($source['store']['selectedModules']) ? implode(',', $source['store']['selectedModules']) : ''; $result[Installer::DISABLE_MODULES] = isset($source['store']['allModules']) diff --git a/setup/src/Magento/Setup/Controller/WebConfiguration.php b/setup/src/Magento/Setup/Controller/WebConfiguration.php index 1197a234c0ad9858e588106ddaa541cbefab104a..ad9d3bfb1adf4fcd6193af506648090839f58f70 100644 --- a/setup/src/Magento/Setup/Controller/WebConfiguration.php +++ b/setup/src/Magento/Setup/Controller/WebConfiguration.php @@ -5,9 +5,10 @@ */ namespace Magento\Setup\Controller; +use Magento\Framework\App\SetupInfo; +use Magento\Framework\Config\ConfigOptionsListConstants; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; -use Magento\Framework\App\SetupInfo; class WebConfiguration extends AbstractActionController { @@ -22,7 +23,11 @@ class WebConfiguration extends AbstractActionController $view = new ViewModel( [ 'autoBaseUrl' => $setupInfo->getProjectUrl(), - 'autoAdminPath' => $setupInfo->getProjectAdminPath() + 'autoAdminPath' => $setupInfo->getProjectAdminPath(), + 'sessionSave' => [ + ConfigOptionsListConstants::SESSION_SAVE_FILES, + ConfigOptionsListConstants::SESSION_SAVE_DB, + ], ] ); $view->setTerminal(true); diff --git a/setup/src/Magento/Setup/Model/ConfigOptionsList.php b/setup/src/Magento/Setup/Model/ConfigOptionsList.php index bcc84dca9bd7fa8fdb6477b5b759e7aa2b78ded1..fc49535e28b088a63cd02e3514cef9347d6cd4b3 100644 --- a/setup/src/Magento/Setup/Model/ConfigOptionsList.php +++ b/setup/src/Magento/Setup/Model/ConfigOptionsList.php @@ -37,7 +37,6 @@ class ConfigOptionsList implements ConfigOptionsListInterface private $validSaveHandlers = [ ConfigOptionsListConstants::SESSION_SAVE_FILES, ConfigOptionsListConstants::SESSION_SAVE_DB, - ConfigOptionsListConstants::SESSION_SAVE_REDIS ]; /** diff --git a/setup/src/Magento/Setup/Model/FilePermissions.php b/setup/src/Magento/Setup/Model/FilePermissions.php index 18f6de73d4f70766a3631a9bc5890a84d8c52674..16e71b2010197fa1162b5ec4ac121d6419d64a2f 100644 --- a/setup/src/Magento/Setup/Model/FilePermissions.php +++ b/setup/src/Magento/Setup/Model/FilePermissions.php @@ -109,7 +109,7 @@ class FilePermissions { if (!$this->installationCurrentWritableDirectories) { foreach ($this->installationWritableDirectories as $code => $path) { - if ($this->isWritable($code)) { + if ($this->isWritable($code) && $this->checkRecursiveDirectories($path)) { $this->installationCurrentWritableDirectories[] = $path; } } @@ -117,6 +117,26 @@ class FilePermissions return $this->installationCurrentWritableDirectories; } + /** + * Check all sub-directories + * + * @param string $directory + * @return bool + */ + private function checkRecursiveDirectories($directory) + { + $directoryIterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($directory), + \RecursiveIteratorIterator::LEAVES_ONLY | \RecursiveIteratorIterator::CATCH_GET_CHILD + ); + foreach ($directoryIterator as $subDirectory) { + if ($subDirectory->isDir() && !$subDirectory->isWritable()) { + return false; + } + } + return true; + } + /** * Retrieve list of currently non-writable directories for application * diff --git a/setup/view/magento/setup/readiness-check/progress.phtml b/setup/view/magento/setup/readiness-check/progress.phtml index 53ca61521c556249a18ffa14ec85d6e5b90bfeb4..3ddb6e434f6827b02df2e3930d75ede08b4091c8 100755 --- a/setup/view/magento/setup/readiness-check/progress.phtml +++ b/setup/view/magento/setup/readiness-check/progress.phtml @@ -446,7 +446,9 @@ </a> </p> <p> - The best way to resolve this is to allow write permissions for the following Magento directories. The exact fix depends on your server, your host, and other system variables. + The best way to resolve this is to allow write permissions for the following Magento + directories and their sub-directories. The exact fix depends on your server, your host, + and other system variables. <br> Our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/cman/tshoot_install_perms.html" target="_blank">File Permission Help</a> can get you started. </p> diff --git a/setup/view/magento/setup/web-configuration.phtml b/setup/view/magento/setup/web-configuration.phtml index 5101643a6defc7f2ccfabe3cd7e2830e9d6612d4..c8f7d0f1b5e80c4f38b5b7d862647ef0724bad3f 100644 --- a/setup/view/magento/setup/web-configuration.phtml +++ b/setup/view/magento/setup/web-configuration.phtml @@ -61,7 +61,7 @@ $hints = [ <input id="baseUrl" class="form-el-input" - type="text" + type="url" name="base_url" ng-model="config.address.base_url" ng-class="{'invalid': webconfig.base_url.$invalid && webconfig.submitted}" @@ -281,6 +281,29 @@ $hints = [ </div> </div> + <div class="row form-row"> + <div class="col-m-3"> + <label class="form-label required"> + Session Save + </label> + </div> + <div class="col-m-4"> + <select + name="session" + class="form-el-select" + ng-model="config.sessionSave.type" + ng-class="{'invalid': webconfig.session.$invalid && webconfig.submitted}" + tooltip-placement="right" + tooltip-html-unsafe="The location of session. You can change this later in Magento Admin." + tooltip-trigger="focus" + tooltip-append-to-body="true" + > + <?php foreach ($this->sessionSave as $value):?> + <?php echo "<option value=\"" . $value . "\">" . ucfirst($value) . "</option>"; ?> + <?php endforeach; ?> + </select> + </div> + </div> </div> </fieldset>