Ejemplo n.º 1
0
 public function actionUpdate()
 {
     $result = WebConsole::migrate();
     Setting::set('easyii_version', \yii\easyii\AdminModule::VERSION);
     Yii::$app->cache->flush();
     return $this->render('update', ['result' => $result]);
 }
Ejemplo n.º 2
0
 public function actionIndex()
 {
     if (!$this->checkDbConnection()) {
         $configFile = str_replace(Yii::getAlias('@webroot'), '', Yii::getAlias('@app')) . '/config/db.php';
         return $this->showError(Yii::t('easyii/install', 'Cannot connect to database. Please configure `{0}`.', $configFile));
     }
     if ($this->module->installed) {
         return $this->showError(Yii::t('easyii/install', 'EasyiiCMS is already installed. If you want to reinstall easyiiCMS, please drop all tables with prefix `easyii_` from your database manually.'));
     }
     $installForm = new InstallForm();
     if ($installForm->load(Yii::$app->request->post())) {
         $this->createUploadsDir();
         WebConsole::migrate();
         $this->insertSettings($installForm);
         $this->installModules();
         Yii::$app->cache->flush();
         Yii::$app->session->setFlash(InstallForm::ROOT_PASSWORD_KEY, $installForm->root_password);
         return $this->redirect(['/admin/install/finish']);
     } else {
         $installForm->robot_email = 'noreply@' . Yii::$app->request->serverName;
         return $this->render('index', ['model' => $installForm]);
     }
 }