Exemple #1
0
 /**
  * Initialize the loader
  */
 public static function init()
 {
     $config = SugarConfig::getInstance();
     /*
      * When development mode is enabled, we bypass the usage
      * of the filemap and build the classmap dynamically on
      * every page load. We drop both cache file to make sure
      * when devMode is disabled again that the system is
      * properly initialized again withour the need for
      * running a QuickRepairRebuild.
      */
     self::$devMode = $config->get('developerMode', false);
     if (self::$devMode) {
         @unlink(sugar_cached(self::CACHE_FILE));
         @unlink(sugar_cached(self::CLASS_CACHE_FILE));
     }
     // Extensions included from config
     $exts = $config->get('autoloader.exts');
     if (is_array($exts)) {
         self::$exts += $exts;
     }
     // Excludes from config
     $exclude = $config->get('autoloader.exclude');
     if (is_array($exclude)) {
         self::$exclude += $exclude;
     }
     // Create file map
     self::loadFileMap();
     // Composer integration
     self::loadComposerIncludePaths();
     self::loadComposerPsr4();
     self::loadComposerPsr0();
     // Build class map (implicitly includes Composer's classmap)
     self::loadClassMap();
     // Register ourself (prepend)
     self::registerAutoload(true);
     // Load extensions
     self::loadExts();
 }