Skip to content

Commit

Permalink
Merge pull request #74 from magento-ogre/PR_Branch
Browse files Browse the repository at this point in the history
[Ogres] Bugfixes
  • Loading branch information
dkvashninbay committed Oct 30, 2015
2 parents 116d6ac + a108ffd commit eacba1c
Show file tree
Hide file tree
Showing 77 changed files with 764 additions and 153 deletions.
11 changes: 9 additions & 2 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@
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');
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/etc/product_options_merged.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/etc/product_types.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/etc/product_types_merged.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -73,10 +66,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
}

$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);
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Config/etc/system_include.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
Loading

0 comments on commit eacba1c

Please sign in to comment.