Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 60 additions & 3 deletions app/code/core/Mage/Adminhtml/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
*/
class Mage_Adminhtml_Model_Config extends Varien_Simplexml_Config
{
/**
* @var string
*/
protected $_cacheId = 'mage_adminhtml_config_system_xml';

/**
* @var Mage_Core_Model_Config_Base
*/
protected $_config;

/**
* Enter description here...
Expand Down Expand Up @@ -80,16 +89,64 @@ public function getTabs()
return $this->_tabs;
}

public function __construct()
{
$this->_cacheChecksum = null;
$this->setCache(Mage::app()->getCache());
$this->setCacheTags([Mage_Core_Model_Config::CACHE_TAG]);
$usesCache = Mage::app()->useCache('config');
if (!$usesCache || !$this->loadCache()) {
/** @var Mage_Core_Model_Config_Base $config */
$this->_config = Mage::getConfig()->loadModulesConfiguration('system.xml')
->applyExtends();
if ($usesCache) {
$this->saveCache();
}
}
}

/**
* @param $tags
* @return $this|Mage_Adminhtml_Model_Config
*/
public function saveCache($tags=null)
{
if ($this->getCacheSaved()) {
return $this;
}
if (is_null($tags)) {
$tags = $this->_cacheTags;
}
$xmlString = $this->_config->getXmlString();
$this->_saveCache($xmlString, $this->getCacheId(), $tags, $this->getCacheLifetime());
$this->setCacheSaved(true);
return $this;
}

/**
* @return bool
*/
public function loadCache()
{
$xmlString = $this->_loadCache($this->getCacheId());
$class = Mage::getConfig()->getModelClassName('core/config_base');
$this->_config = new $class();
libxml_use_internal_errors(true);
if (!empty($xmlString) && $this->_config->loadString($xmlString)) {
return true;
}
libxml_clear_errors();
return false;
}

/**
* Init modules configuration
*
* @return void
*/
protected function _initSectionsAndTabs()
{
$config = Mage::getConfig()->loadModulesConfiguration('system.xml')
->applyExtends();

$config = $this->_config;
Mage::dispatchEvent('adminhtml_init_system_config', array('config' => $config));
$this->_sections = $config->getNode('sections');
$this->_tabs = $config->getNode('tabs');
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<types>
<config translate="label,description" module="core">
<label>Configuration</label>
<description>System(config.xml, local.xml) and modules configuration files(config.xml).</description>
<description>System (config.xml, local.xml) and modules configuration files (config.xml, system.xml).</description>
<tags>CONFIG</tags>
</config>
<layout translate="label,description" module="core">
Expand Down
1 change: 1 addition & 0 deletions app/locale/en_US/Mage_Core.csv
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,4 @@
"You will have to log in after you save your custom admin path.","You will have to log in after you save your custom admin path."
"Your design change for the specified store intersects with another one, please specify another date range.","Your design change for the specified store intersects with another one, please specify another date range."
"database ""%s""","database ""%s"""
"System (config.xml, local.xml) and modules configuration files (config.xml, system.xml).","System (config.xml, local.xml) and modules configuration files (config.xml, system.xml)."