public function testGetRunOptions() { $model = new Mage_Core_Model_App_Options(array('ignored_option' => 'ignored value')); $this->assertEmpty($model->getRunOptions()); $extraLocalConfigFile = 'test/local.xml'; $inputOptions = array(Mage_Core_Model_App_Options::OPTION_LOCAL_CONFIG_EXTRA_FILE => $extraLocalConfigFile); $expectedRunOptions = array(Mage_Core_Model_Config::OPTION_LOCAL_CONFIG_EXTRA_FILE => $extraLocalConfigFile); $model = new Mage_Core_Model_App_Options($inputOptions); $this->assertEquals($expectedRunOptions, $model->getRunOptions()); }
<?php /** * Application entry point * * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage * @package Mage * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once __DIR__ . '/app/bootstrap.php'; $appOptions = new Mage_Core_Model_App_Options($_SERVER); Mage::run($appOptions->getRunCode(), $appOptions->getRunType(), $appOptions->getRunOptions());
$mediaDirectory = trim(str_replace($publicDirectory, '', $config['media_directory']), DS); $allowedResources = array_merge($allowedResources, $config['allowed_resources']); } } $request = new Zend_Controller_Request_Http(); $pathInfo = str_replace('..', '', ltrim($request->getPathInfo(), '/')); $filePath = str_replace('/', DS, $publicDirectory . DS . $pathInfo); if ($mediaDirectory) { if (0 !== stripos($pathInfo, $mediaDirectory . '/') || is_dir($filePath)) { sendNotFoundPage(); } $relativeFilename = str_replace($mediaDirectory . '/', '', $pathInfo); checkResource($relativeFilename, $allowedResources); sendFile($filePath); } $appOptions = new Mage_Core_Model_App_Options($_SERVER); if (empty($mediaDirectory)) { Mage::init($appOptions->getRunCode(), $appOptions->getRunType(), $appOptions->getRunOptions()); } else { $appRunOptions = array_merge($appOptions->getRunOptions(), array('cache' => array('disallow_save' => true))); Mage::init($appOptions->getRunCode(), $appOptions->getRunType(), $appRunOptions, array('Mage_Core')); } Mage::app()->requireInstalledInstance(); if (!$mediaDirectory) { $config = Mage_Core_Model_File_Storage::getScriptConfig(); $mediaDirectory = str_replace($publicDirectory, '', $config['media_directory']); $allowedResources = array_merge($allowedResources, $config['allowed_resources']); $relativeFilename = str_replace($mediaDirectory . '/', '', $pathInfo); $fp = fopen($configCacheFile, 'w'); if (flock($fp, LOCK_EX | LOCK_NB)) { ftruncate($fp, 0);