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; }
/** * 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; }