* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Environment initialization */ error_reporting(E_ALL); #ini_set('display_errors', 1); umask(0); /* PHP version validation */ if (version_compare(phpversion(), '5.4.11', '<') === true) { if (PHP_SAPI == 'cli') { echo 'Magento supports PHP 5.4.11 or newer. Please read http://www.magento.com/install.'; } else { echo <<<HTML <div style="font:12px/1.35em arial, helvetica, sans-serif;"> <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"> <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;"> Whoops, it looks like you have an invalid PHP version.</h3> </div> <p>Magento supports PHP 5.4.11 or newer. </div> HTML; } exit(1); } 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'])); } date_default_timezone_set(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::DEFAULT_TIMEZONE);
/** * @dataProvider applyConfigDataProvider * @param array $config * @param array $expectedDrivers */ public function testApplyConfigWithDrivers(array $config, array $expectedDrivers) { \Magento\Framework\Profiler::applyConfig($config, ''); $this->assertAttributeEquals($expectedDrivers, '_drivers', 'Magento\\Framework\\Profiler'); }
<?php if (PHP_SAPI != 'cli') { $_SERVER['MAGE_PROFILER_STAT'] = new \Magento\Framework\Profiler\Driver\Standard\Stat(); \Magento\Framework\Profiler::applyConfig(['drivers' => [['output' => 'Mirasvit\\Profiler\\Model\\Driver\\Output\\Html', 'stat' => $_SERVER['MAGE_PROFILER_STAT']]]], BP, false); } \Magento\Framework\Component\ComponentRegistrar::register(\Magento\Framework\Component\ComponentRegistrar::MODULE, 'Mirasvit_Profiler', __DIR__);
/** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ /** * Environment initialization */ error_reporting(E_ALL); #ini_set('display_errors', 1); umask(0); /* PHP version validation */ if (version_compare(phpversion(), '5.5.0', '<') === true) { if (PHP_SAPI == 'cli') { echo 'Magento supports PHP 5.5.0 or later. ' . 'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html'; } else { echo <<<HTML <div style="font:12px/1.35em arial, helvetica, sans-serif;"> <p>Magento supports PHP 5.5.0 or later. Please read <a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html"> Magento System Requirements</a>. </div> HTML; } exit(1); } require_once __DIR__ . '/autoload.php'; require_once BP . '/app/functions.php'; 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'); } date_default_timezone_set('UTC');
public function testApplyConfig() { $mockDriver = $this->getMock('Magento\\Framework\\Profiler\\DriverInterface'); $driverConfig = ['type' => 'foo']; $mockDriverFactory = $this->getMockBuilder('Magento\\Framework\\Profiler\\Driver\\Factory')->disableOriginalConstructor()->getMock(); $config = ['drivers' => [$driverConfig], 'driverFactory' => $mockDriverFactory, 'tagFilters' => ['tagName' => 'tagValue']]; $mockDriverFactory->expects($this->once())->method('create')->with($driverConfig)->will($this->returnValue($mockDriver)); \Magento\Framework\Profiler::applyConfig($config, ''); $this->assertAttributeEquals([$mockDriver], '_drivers', 'Magento\\Framework\\Profiler'); $this->assertAttributeEquals(['tagName' => ['tagValue']], '_tagFilters', 'Magento\\Framework\\Profiler'); $this->assertAttributeEquals(true, '_enabled', 'Magento\\Framework\\Profiler'); }