Ejemplo n.º 1
0
 /**
  * Installs a given moduleId from marketplace
  */
 public function actionInstall()
 {
     $this->forcePostRequest();
     $moduleId = Yii::$app->request->get('moduleId');
     if (!Yii::$app->moduleManager->hasModule($moduleId)) {
         $onlineModules = new OnlineModuleManager();
         $onlineModules->install($moduleId);
     }
     // Redirect to Module Install?
     $this->redirect(['/admin/module/list']);
 }
Ejemplo n.º 2
0
 /**
  * Updates all modules to the latest available version.
  *
  * @param array $args
  */
 public function actionUpdateAll()
 {
     // Also install modules which are seems to be installed
     $installedModules = Yii::$app->moduleManager->getModules(['returnClass' => true]);
     foreach ($installedModules as $moduleId => $className) {
         $this->actionUpdate($moduleId);
     }
     /**
      * Looking up modules which are marked as installed but not loaded.
      * Try to get recent version online.
      */
     foreach (\humhub\models\ModuleEnabled::getEnabledIds() as $moduleId) {
         if (!in_array($moduleId, array_keys($installedModules))) {
             // Module seems to be installed - but cannot be loaded
             // Try force re-install
             try {
                 $onlineModules = new OnlineModuleManager();
                 $onlineModules->install($moduleId);
                 print "Reinstalled: " . $moduleId . "\n";
             } catch (Exception $ex) {
             }
         }
     }
 }