Exemplo n.º 1
0
 /**
  * load new modules from the modules/ directory
  *
  * @return void
  */
 public function loadNewModules()
 {
     $skipOld = true;
     $mods = array();
     $dir = MODULE_PATH;
     if ($dh = opendir($dir)) {
         while (($file = readdir($dh)) !== false) {
             $filepath = $dir . '/' . $file;
             if (is_dir($filepath)) {
                 $modfile = $filepath . '/mod.xml';
                 if (file_exists($modfile)) {
                     $mods[] = $file;
                 }
             }
         }
         closedir($dh);
     }
     // find all modules
     foreach ($mods as $mod) {
         if ($skipOld && ModuleLoader::isModuleInstalled($mod)) {
             continue;
         }
         $loader = new ModuleLoader($mod);
         $loader->debug = false;
         if (!$loader->loadModule()) {
             $this->m_Errors[] = nl2br($this->GetMessage("MODULE_LOAD_ERROR") . "\n" . $loader->errors . "\n" . $loader->logs);
         } else {
             $this->m_Notices[] = $this->GetMessage("MODULE_LOAD_COMPLETE");
             //." ".$loader->logs;
         }
     }
     $this->rerender();
 }
Exemplo n.º 2
0
 /**
  * load new modules from the modules/ directory
  *
  * @return void
  */
 public function loadNewModules($skipOld = true)
 {
     Openbiz::getService(ACL_SERVICE)->clearACLCache();
     $mods = array();
     $dir = Openbiz::$app->getModulePath();
     if ($dh = opendir($dir)) {
         while (($file = readdir($dh)) !== false) {
             $filepath = $dir . '/' . $file;
             if (is_dir($filepath)) {
                 $modfile = $filepath . '/mod.xml';
                 if (file_exists($modfile)) {
                     $mods[] = $file;
                 }
             }
         }
         closedir($dh);
     }
     // find all modules
     foreach ($mods as $mod) {
         if ($skipOld == true && ModuleLoader::isModuleInstalled($mod)) {
             continue;
         }
         if (!ModuleLoader::isModuleOld($mod)) {
             continue;
         }
         $loader = new ModuleLoader($mod);
         $loader->debug = false;
         if (!$loader->loadModule()) {
             $this->errors[] = nl2br($this->GetMessage("MODULE_LOAD_ERROR", $mod) . "\n" . $loader->errors . "\n" . $loader->logs);
         } else {
             $this->notices[] = $this->GetMessage("MODULE_LOAD_COMPLETE", $mod);
             //." ".$loader->logs;
         }
     }
     $this->rerender();
 }