public function actionUpdate()
 {
     $result = WebConsole::migrate();
     Setting::set('easyii_version', \yii\easyii\AdminModule::VERSION);
     Yii::$app->cache->flush();
     return $this->render('update', ['result' => $result]);
 }
Example #2
0
 public function bootstrap($app)
 {
     Yii::setAlias('@understeam', dirname(dirname(__DIR__)));
     if (!isset(Yii::$app->i18n->translations['understeam/feedback'])) {
         Yii::$app->i18n->translations['understeam/feedback'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en-US', 'basePath' => '@understeam/easyii-feedback/src/messages'];
     }
     try {
         Feedback::getTableSchema();
     } catch (InvalidConfigException $e) {
         if (Yii::$app->request->get('install-understeam-feedback') === '1') {
             ob_start();
             WebConsole::console()->runAction('migrate', ['migrationPath' => __DIR__ . '/migrations', 'migrationTable' => 'understeam_feedback_migration', 'interactive' => false]);
             echo "<h1>Table successfully created!</h1>";
             echo "<p><a href=\"" . strtr(Yii::$app->request->url, ['install-understeam-feedback=1' => 'installed=1']) . "\">Continue!</a></p>";
             Yii::$app->end();
         } else {
             echo "<h1>Understeam feedback module is not installed yet!</h1>";
             echo "<p><a href=\"?install-understeam-feedback=1\">Install now!</a></p>";
             Yii::$app->end();
         }
     }
 }
 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]);
     }
 }