本文整理匯總了PHP中sfAutoload::freshCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfAutoload::freshCache方法的具體用法?PHP sfAutoload::freshCache怎麽用?PHP sfAutoload::freshCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfAutoload
的用法示例。
在下文中一共展示了sfAutoload::freshCache方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reloadClasses
public function reloadClasses($force = false)
{
if (self::$freshCache && !$force)
{
return false;
}
$configuration = sfProjectConfiguration::getActive();
if (!$configuration || !$configuration instanceof sfApplicationConfiguration)
{
return false;
}
self::$freshCache = true;
if (file_exists($configuration->getConfigCache()->getCacheName('config/autoload.yml')))
{
self::$freshCache = false;
if ($force)
{
unlink($configuration->getConfigCache()->getCacheName('config/autoload.yml'));
}
}
$file = $configuration->getConfigCache()->checkConfig('config/autoload.yml');
$this->classes = include($file);
foreach ($this->overriden as $class => $path)
{
$this->classes[$class] = $path;
}
return true;
}
示例2: reloadClasses
/**
* Reloads the autoloader.
*
* @param boolean $force Whether to force a reload
*
* @return boolean True if the reload was successful, otherwise false
*/
public function reloadClasses($force = false)
{
// only (re)load the autoloading cache once per request
if (self::$freshCache && !$force) {
return false;
}
$configuration = sfProjectConfiguration::getActive();
if (!$configuration || !$configuration instanceof sfApplicationConfiguration) {
return false;
}
self::$freshCache = true;
if (is_file($configuration->getConfigCache()->getCacheName('config/autoload.yml'))) {
self::$freshCache = false;
if ($force) {
if (file_exists($configuration->getConfigCache()->getCacheName('config/autoload.yml'))) {
unlink($configuration->getConfigCache()->getCacheName('config/autoload.yml'));
}
}
}
$file = $configuration->getConfigCache()->checkConfig('config/autoload.yml');
if ($force && defined('HHVM_VERSION')) {
// workaround for https://github.com/facebook/hhvm/issues/1447
$this->classes = eval(str_replace('<?php', '', file_get_contents($file)));
} else {
$this->classes = (include $file);
}
foreach ($this->overriden as $class => $path) {
$this->classes[$class] = $path;
}
return true;
}