function get_config_dirs($configPath) { $dirs = array(); foreach (sfLoader::getConfigPaths($configPath) as $dir) { $dirs[] = $dir; } return array_map('strip_paths', $dirs); }
/** * Checks to see if a configuration file has been modified and if so * recompile the cache file associated with it. * * The recompilation only occurs in a non debug environment. * * If the configuration file path is relative, symfony will look in directories * defined in the sfLoader::getConfigPaths() method. * * @param string A filesystem path to a configuration file * * @return string An absolute filesystem path to the cache filename associated with this specified configuration file * * @throws <b>sfConfigurationException</b> If a requested configuration file does not exist * * @see sfLoader::getConfigPaths() */ public function checkConfig($configPath, $optional = false) { static $process_cache_cleared = false; if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) { $timer = sfTimerManager::getTimer('Configuration'); } // the cache filename we'll be using $cache = $this->getCacheName($configPath); if (sfConfig::get('sf_in_bootstrap') && is_readable($cache)) { if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) { $timer->addTime(); } return $cache; } if (!sfToolkit::isPathAbsolute($configPath)) { $files = sfLoader::getConfigPaths($configPath); } else { $files = is_readable($configPath) ? array($configPath) : array(); } if (!isset($files[0])) { if ($optional) { return null; } // configuration does not exist $error = sprintf('Configuration "%s" does not exist or is unreadable', $configPath); throw new sfConfigurationException($error); } // find the more recent configuration file last modification time $mtime = 0; foreach ($files as $file) { if (filemtime($file) > $mtime) { $mtime = filemtime($file); } } if (!is_readable($cache) || $mtime > filemtime($cache)) { // configuration has changed so we need to reparse it $this->callHandler($configPath, $files, $cache); // clear process cache if ('config/config_handlers.yml' != $configPath && sfConfig::get('sf_use_process_cache') && !$process_cache_cleared) { sfProcessCache::clear(); $process_cache_cleared = true; } } if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) { $timer->addTime(); } return $cache; }