/** * Initialize application * * @param string $code * @param string $type * @param string $etcDir * @return Mage_Core_Model_App */ public function init($code, $type, $etcDir) { Varien_Profiler::start('app/construct'); $this->setErrorHandler(self::DEFAULT_ERROR_HANDLER); date_default_timezone_set(Mage_Core_Model_Locale::DEFAULT_TIMEZONE); // if ($type==='store') { // $this->_currentStore = $code; // } $this->_config = Mage::getConfig(); $this->_config->init($etcDir); if ($this->isInstalled()) { $this->_initStores(); switch ($type) { case 'store': $this->_currentStore = $code; break; case 'group': $this->_currentStore = $this->_getStoreByGroup($code); break; case 'website': $this->_currentStore = $this->_getStoreByWebsite($code); break; default: Mage::throwException('Invalid Type! Allowed types: website, group, store'); } $this->_checkCookieStore($type); $this->_checkGetStore($type); } Varien_Profiler::stop('app/construct'); return $this; }
/** * Initialization of core configuration * * @return Mage_Core_Model_Config */ public function init($options = array()) { $backend = Mage::app()->getCacheInstance()->getFrontend()->getBackend(); if (get_class($backend) !== 'Made_Cache_Redis_Backend') { return parent::init($options); } $this->setCacheChecksum(null); $this->_cacheLoadedSections = array(); $this->setOptions($options); $this->loadBase(); $cacheLoad = $this->loadModulesCache(); if ($cacheLoad) { return $this; } $lockingOptions = $this->getLockingOptions(); $lockSpun = false; if (empty($options['lock_acquired'])) { // Spin lock while (!$backend->acquireLock($lockingOptions['lock_name'], $lockingOptions['token'], $lockingOptions['lock_timeout'])) { $lockSpun = true; usleep($lockingOptions['spin_timeout']); } } if ($lockSpun) { // The cache might have been generated while we waited for the lock $cacheLoad = $this->loadModulesCache(); if ($cacheLoad) { $backend->releaseLock($lockingOptions['lock_name'], $lockingOptions['token']); return $this; } } // Check cache // @see https://github.com/convenient/magento-ce-ee-config-corruption-bug#the-fix $this->_useCache = false; // </iterations fix> $this->loadModules(); $this->loadDb(); $this->saveCache(); if (empty($options['lock_acquired'])) { $backend->releaseLock($lockingOptions['lock_name'], $lockingOptions['token']); } return $this; }
/** * Initialize application without request processing * * @param string|array $code * @param string $type * @param string|array $options * @return Mage_Core_Model_App */ public function init($code, $type = null, $options = array()) { $this->_initEnvironment(); if (is_string($options)) { $options = array('etc_dir' => $options); } Varien_Profiler::start('mage::app::init::config'); $this->_config = Mage::getConfig(); $this->_config->setOptions($options); $this->_initBaseConfig(); $this->_initCache(); $this->_config->init($options); Varien_Profiler::stop('mage::app::init::config'); if ($this->_isInstalled === null) { $this->_isInstalled = Mage::isInstalled($options); } if ($this->_isInstalled) { $this->_initCurrentStore($code, $type); $this->_initRequest(); } return $this; }
/** * Initialize application * * @param string|array $code * @param string $type * @param string $etcDir * @return Mage_Core_Model_App */ public function init($code, $type = null, $options = array()) { $this->setErrorHandler(self::DEFAULT_ERROR_HANDLER); date_default_timezone_set(Mage_Core_Model_Locale::DEFAULT_TIMEZONE); if (is_string($options)) { $options = array('etc_dir' => $options); } Varien_Profiler::start('mage::app::init::config'); $this->_config = Mage::getConfig(); $this->_config->init($options); Varien_Profiler::stop('mage::app::init::config'); if (Mage::isInstalled($options)) { Varien_Profiler::start('mage::app::init::stores'); $this->_initStores(); Varien_Profiler::stop('mage::app::init::stores'); if (empty($code) && !is_null($this->_website)) { $code = $this->_website->getCode(); $type = 'website'; } switch ($type) { case 'store': $this->_currentStore = $code; break; case 'group': $this->_currentStore = $this->_getStoreByGroup($code); break; case 'website': $this->_currentStore = $this->_getStoreByWebsite($code); break; default: $this->throwStoreException(); } if (!empty($this->_currentStore)) { $this->_checkCookieStore($type); $this->_checkGetStore($type); } $this->getRequest()->setPathInfo(); } return $this; }
public function setUp() { $this->_model = new Mage_Core_Model_Config(); $this->_model->init(self::$_options); }
/** * Instantiate Mage_Core_Model_Config and initialize (load configuration) if needed * * @param bool $initialize * @return Mage_Core_Model_Config */ protected function _createModel($initialize = false) { $model = new Mage_Core_Model_Config(); if ($initialize) { $model->init(self::$_options); } return $model; }
/** * Initialize application without request processing * * @param string|array $code * @param string $type * @param string|array $options * @return Mage_Core_Model_App */ public function init($code, $type = null, $options = array()) { $this->_initEnvironment(); if (is_string($options)) { $options = array('etc_dir' => $options); } Magento_Profiler::start('init_config'); $this->_config = Mage::getConfig(); $this->_config->setOptions($options); $this->_initBaseConfig(); $logger = $this->_initLogger(); $this->_initCache(); $this->_config->init($options); $this->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS); $this->loadDiConfiguration(); Magento_Profiler::stop('init_config'); if (Mage::isInstalled($options)) { $this->_initCurrentStore($code, $type); $logger->initForStore($this->_store); $this->_initRequest(); } return $this; }
public function setUp() { $this->_model = Mage::getModel('Mage_Core_Model_Config'); $this->_model->init(self::$_options); }