protected function cfg($sConfigItemName) { static $abWasHere = array(); //quick hack for dead loops //we can't use any kind of cache here because of dead loop cfg()->cfg() if (!$this->amCfg) { if (!isset($abWasHere[$this->getMyComponentType()][$this->getComponentName()])) { $abWasHere[$this->getMyComponentType()][$this->getComponentName()] = true; // normal process here... try { $this->amCfg = AnwCache_componentConfiguration::getCachedComponentConfiguration($this); } catch (AnwException $e) { //$this->amCfg = $this->retrieveSettingsArrayFromScratch(); //load config, then put it in cache... $this->amCfg = AnwUtils::getSettingsFromFile($this->getComponentName() . ".cfg.php", $this->getMyComponentDir()); AnwCache_componentConfiguration::putCachedComponentConfiguration($this, $this->amCfg); } } else { // special process for quick hack... AnwDebug::log("cfg - deadloop detected, loading settings using alternate way for " . $this->getMyComponentType() . "/" . $this->getComponentName()); //TODO: quick hack for dead loops problem when global settings are not in cache first time... //when calling retrieveSettingsArrayFromScratch(), it will initialize ContentFieldSettings() which may call again cfg(). //to prevent dead loops, we just use the old way for loading config just during the time we generate config correctly and put it in cache. /*$this->amCfg = AnwUtils::getSettingsFromFile($this->getComponentName().".cfg.php", $this->getMyComponentDir()); return $this->amCfg;*/ //TODO temporary check, to remove print "dead lock detected"; exit; } } if (!isset($this->amCfg[$sConfigItemName])) { throw new AnwUnexpectedException("Unable to get config : " . $sConfigItemName); } return $this->amCfg[$sConfigItemName]; }