Esempio n. 1
0
 public function reloadClasses($force = false)
 {
     // only (re)load the autoloading cache once per request
     if (self::$freshCache) {
         return;
     }
     $configuration = sfProjectConfiguration::getActive();
     if (!$configuration || !$configuration instanceof sfApplicationConfiguration) {
         return;
     }
     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);
     //If the user has specified provided one or more class paths
     foreach ($this->overriden as $class => $path) {
         $this->classes[$class] = $path;
     }
     //Remove non Peer classes from the array.
     foreach ($this->classes as $className => $path) {
         if (substr($className, -4, 4) != 'Peer' || substr($className, -4, 4) == 'Peer' && substr($className, 0, 4) == 'Base') {
             unset($this->classes[$className]);
         }
     }
 }