Beispiel #1
0
 /**
  * @param ColibriModule $module
  * @param array $d
  * @return ColibriModule[]
  */
 protected function buildDependencyTree(ColibriModule $module, array &$d = [])
 {
     $d[$module->name()] = $module;
     foreach ($module->dependencies() as $dep) {
         if (!isset($d[$dep->name()])) {
             $this->buildDependencyTree($dep, $d);
         } else {
             $mdl = $d[$dep->name()];
             unset($d[$dep->name()]);
             $d[$dep->name()] = $mdl;
         }
     }
     return $d;
 }
Beispiel #2
0
 /**
  * @return array
  */
 protected function resolveInfo() : array
 {
     return ['name' => $this->module->name(), 'title' => $this->module->title(), 'version' => $this->module->version(), 'description' => $this->module->description(), 'dependencies' => array_map(function (Module $module) {
         return $module->name();
     }, $this->module->dependencies()), 'dependents' => array_map(function (Module $module) {
         return $module->name();
     }, $this->module->dependents()), 'hidden' => $this->module->isHidden(), 'collector' => $this->module->collector(), 'installer' => $this->module->installer(), 'assets' => $this->module->assets()];
 }
Beispiel #3
0
 /**
  * Disable a module
  *
  * @param   Module $module
  * @param   boolean $recollect (optional)
  *
  * @return  boolean
  */
 public function disable(Module $module, bool $recollect = true) : bool
 {
     if (!$module->canBeDisabled()) {
         return false;
     }
     $config = $this->getConfig();
     $modules = $config->read('modules.enabled', array());
     $config->write('modules.enabled', array_diff($modules, array($module->name())));
     if (false !== ($installer = $module->installer())) {
         $this->getContainer()->make($installer)->disable();
     }
     $this->getComposerCLI()->dumpAutoload();
     $this->reloadClassLoader();
     if ($recollect) {
         $this->getCollector()->recollect();
     }
     $this->emit('module.disabled.' . $module->name());
     return true;
 }