示例#1
0
 function load($modules)
 {
     $this->init();
     if (!is_array($modules)) {
         $modules = array($modules);
     }
     foreach ($modules as $m) {
         if (array_key_exists($m, ModuleManager::$modules)) {
             continue;
         }
         while ($this->lpa_index < $this->lpa_count) {
             $row = $this->lpa[$this->lpa_index++];
             $module = $row['name'];
             $version = $row['version'];
             ModuleManager::include_common($module, $version);
             ModuleManager::register($module, $version, ModuleManager::$modules);
             if ($m != self::all_modules && $module == $m) {
                 break;
             }
         }
     }
 }
示例#2
0
 /**
  * Loads all installed classes definitions.
  *
  * Do not use directly.
  */
 public static final function load_modules()
 {
     self::$modules = array();
     $installed_modules = ModuleManager::get_load_priority_array(true);
     $cached = false;
     if (FORCE_CACHE_COMMON_FILES) {
         $cache_file = DATA_DIR . '/cache/common.php';
         if (!file_exists($cache_file)) {
             self::create_common_cache();
         }
         ob_start();
         require_once $cache_file;
         ob_end_clean();
         $cached = true;
     }
     foreach ($installed_modules as $row) {
         $module = $row['name'];
         $version = $row['version'];
         ModuleManager::register($module, $version, self::$modules);
     }
     // all commons already loaded by FORCE_CACHE_COMMON_FILES
     if ($cached) {
         return;
     }
     $commons_with_code = Cache::get('commons_with_code');
     if ($commons_with_code === null) {
         $commons_with_code = array();
         foreach ($installed_modules as $row) {
             $module = $row['name'];
             $version = $row['version'];
             if (self::common_has_code($module, $version)) {
                 $commons_with_code[$module] = $version;
             }
         }
         Cache::set('commons_with_code', $commons_with_code);
         // this code includes all Common files to check for the code
         // because there is a return
         return;
     }
     foreach ($commons_with_code as $module => $version) {
         if (isset(self::$modules[$module])) {
             self::include_common($module, $version);
         }
     }
 }