Ejemplo n.º 1
0
 public function actionIndex()
 {
     $isNewVersionAvailable = false;
     $isUpToDate = false;
     $latestVersion = "";
     if ($this->module->marketplaceEnabled) {
         $onlineModuleManager = new OnlineModuleManager();
         $latestVersion = $onlineModuleManager->getLatestHumHubVersion();
         if ($latestVersion) {
             $isNewVersionAvailable = version_compare($latestVersion, Yii::$app->version, ">");
             $isUpToDate = !$isNewVersionAvailable;
         }
     }
     return $this->render('index', array('currentVersion' => Yii::$app->version, 'latestVersion' => $latestVersion, 'isNewVersionAvailable' => $isNewVersionAvailable, 'isUpToDate' => $isUpToDate));
 }
Ejemplo n.º 2
0
 /**
  * Check if there is a new Humhub Version available and sends a notification
  * to super admins
  *
  * @param \yii\base\Event $event
  */
 public static function onCronDailyRun($event)
 {
     $controller = $event->sender;
     if (!Yii::$app->getModule('admin')->marketplaceEnabled) {
         return;
     }
     $controller->stdout("Checking for new HumHub version... ");
     $onlineModuleManager = new OnlineModuleManager();
     $latestVersion = $onlineModuleManager->getLatestHumHubVersion();
     if ($latestVersion != "" && version_compare($latestVersion, Yii::$app->version, ">")) {
         $notification = new notifications\NewVersionAvailable();
         $notification->add(User::find()->where(['super_admin' => 1]));
     }
     $controller->stdout('done. ' . PHP_EOL, \yii\helpers\Console::FG_GREEN);
 }