コード例 #1
1
 public function actionAuto()
 {
     $this->stdout("Install:\n\n", Console::FG_YELLOW);
     \humhub\modules\installer\libs\InitialData::bootstrap();
     Yii::$app->settings->set('name', "HumHub Test");
     Yii::$app->settings->set('mailer.systemEmailName', "*****@*****.**");
     Yii::$app->settings->set('mailer.systemEmailName', "*****@*****.**");
     Yii::$app->settings->set('secret', \humhub\libs\UUID::v4());
     $user = new User();
     //$user->group_id = 1;
     $user->username = "******";
     $user->email = '*****@*****.**';
     $user->status = User::STATUS_ENABLED;
     $user->language = '';
     $user->last_activity_email = new \yii\db\Expression('NOW()');
     if (!$user->save()) {
         throw new \yii\base\Exception("Could not save user");
     }
     $user->profile->title = "System Administration";
     $user->profile->firstname = "John";
     $user->profile->lastname = "Doe";
     $user->profile->save();
     $password = new Password();
     $password->user_id = $user->id;
     $password->setPassword('test');
     $password->save();
     // Assign to system admin group
     Group::getAdminGroup()->addUser($user);
     return self::EXIT_CODE_NORMAL;
 }
コード例 #2
0
 /**
  * Index is only called on fresh databases, when there are already settings
  * in database, the user will directly redirected to actionFinished()
  */
 public function actionIndex()
 {
     if (Setting::Get('name') == "") {
         Setting::Set('name', "HumHub");
     }
     \humhub\modules\installer\libs\InitialData::bootstrap();
     return $this->redirect(Url::to(['//installer/config/basic']));
 }
コード例 #3
0
 /**
  * Index is only called on fresh databases, when there are already settings
  * in database, the user will directly redirected to actionFinished()
  */
 public function actionIndex()
 {
     if (Yii::$app->settings->get('name') == "") {
         Yii::$app->settings->set('name', "HumHub");
     }
     \humhub\modules\installer\libs\InitialData::bootstrap();
     return $this->redirect(Yii::$app->getModule('installer')->getNextConfigStepUrl());
 }