/** * @todo Should we throw an exception if the config value does not exist? */ public static function getConfigValueFor($input) { $cache = sfConfig::get('app_phpbb_cache', false); if (!$cache) { $configValues = self::getConfigValues(); if (isset($configValues[$input])) { return $configValues[$input]; } } if ($cache) { $cacheKeyNonDynamic = 'config_values'; $cacheKeyDynamic = 'config_values_dynamic'; if (sfProcessCache::has($cacheKeyNonDynamic)) { $configValues = sfProcessCache::get($cacheKeyNonDynamic); } else { $configValues = self::getConfigValues(0); sfProcessCache::set($cacheKeyNonDynamic, $configValues, myTools::getConfig('app_cache_config_non_dynamic', 86400)); } if (isset($configValues[$input])) { return $configValues[$input]; } // Reset config values before we check dynamic config values unset($configValues); if (sfProcessCache::has($cacheKeyDynamic)) { $configValues = sfProcessCache::get($cacheKeyDynamic); } else { $configValues = self::getConfigValues(1); sfProcessCache::set($cacheKeyDynamic, $configValues, myTools::getConfig('app_cache_config_dynamic', 60)); } if (isset($configValues[$input])) { return $configValues[$input]; } } // If we get here, there is no config value for this input. return null; }