Ejemplo n.º 1
0
 private static function putToCache($name, $path)
 {
     PWELogger::info('Putting to cache path for %s', $name);
     $cache_file = self::getCacheFile();
     $path = realpath($path);
     $oldpath = isset(self::$cache[$name]) ? self::$cache[$name] : false;
     PWELogger::debug("Old path was: %s / new path: %s", $oldpath, $path);
     if ($oldpath != $path) {
         PWELogger::info("Module path changed for %s, needs re-register: %s", $name, $path);
         if (isset(self::$core)) {
             self::$core->getModulesManager()->registerModule($name);
         }
         self::$cache[$name] = $path;
         PWELogger::debug("Classpath cache file: %s", $cache_file);
         if ($cache_file) {
             file_put_contents($cache_file, serialize(self::$cache));
         }
         return true;
     }
     return false;
 }