protected function _loadApplications()
{
global $cli, $injector;
if (!empty($this->_interfaces)) {
return;
}
/* First, try to load from cache. */
if (!isset($cli) && !$this->isTest()) {
if (Horde_Util::extensionExists('apc')) {
$cstorage = 'Horde_Cache_Storage_Apc';
} elseif (Horde_Util::extensionExists('xcache')) {
$cstorage = 'Horde_Cache_Storage_Xcache';
} else {
$cstorage = 'Horde_Cache_Storage_File';
}
$cache = new Horde_Cache(new $cstorage(array('no_gc' => true, 'prefix' => 'horde_registry_cache_')), array('lifetime' => 0, 'logger' => $injector->getInstance('Horde_Log_Logger')));
if (($cid = $this->_cacheId()) && ($cdata = $cache->get($cid, 0))) {
try {
list($this->applications, $this->_interfaces) = $injector->getInstance('Horde_Pack')->unpack($cdata);
return;
} catch (Horde_Pack_Exception $e) {
}
}
}
$config = new Horde_Registry_Registryconfig($this);
$this->applications = $config->applications;
$this->_interfaces = $config->interfaces;
if (!isset($cache)) {
return;
}
/* Need to determine hash of generated data, since it is possible that
* there is dynamic data in the config files. This only needs to
* be done once per session. */
$packed_data = $injector->getInstance('Horde_Pack')->pack(array($this->applications, $this->_interfaces));
$cid = $this->_cacheId($packed_data);
if (!$cache->exists($cid, 0)) {
$cache->set($cid, $packed_data);
}
}