本文整理汇总了PHP中sfLoader::getConfigPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP sfLoader::getConfigPaths方法的具体用法?PHP sfLoader::getConfigPaths怎么用?PHP sfLoader::getConfigPaths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfLoader
的用法示例。
在下文中一共展示了sfLoader::getConfigPaths方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_config_dirs
function get_config_dirs($configPath)
{
$dirs = array();
foreach (sfLoader::getConfigPaths($configPath) as $dir) {
$dirs[] = $dir;
}
return array_map('strip_paths', $dirs);
}
示例2: checkConfig
/**
* 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;
}