private function insertSettings($installForm) { $db = Yii::$app->db; $password_salt = Yii::$app->security->generateRandomString(); $root_auth_key = Yii::$app->security->generateRandomString(); $root_password = sha1($installForm->root_password . $root_auth_key . $password_salt); $db->createCommand()->insert(Setting::tableName(), ['name' => 'recaptcha_key', 'value' => $installForm->recaptcha_key, 'title' => Yii::t('easyii/install', 'ReCaptcha key'), 'visibility' => Setting::VISIBLE_ROOT])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'password_salt', 'value' => $password_salt, 'title' => 'Password salt', 'visibility' => Setting::VISIBLE_NONE])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'root_auth_key', 'value' => $root_auth_key, 'title' => 'Root authorization key', 'visibility' => Setting::VISIBLE_NONE])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'root_password', 'value' => $root_password, 'title' => Yii::t('easyii/install', 'Root password'), 'visibility' => Setting::VISIBLE_ROOT])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'auth_time', 'value' => 86400, 'title' => Yii::t('easyii/install', 'Auth time'), 'visibility' => Setting::VISIBLE_ROOT])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'robot_email', 'value' => $installForm->robot_email, 'title' => Yii::t('easyii/install', 'Robot E-mail'), 'visibility' => Setting::VISIBLE_ROOT])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'admin_email', 'value' => $installForm->admin_email, 'title' => Yii::t('easyii/install', 'Admin E-mail'), 'visibility' => Setting::VISIBLE_ALL])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'recaptcha_secret', 'value' => $installForm->recaptcha_secret, 'title' => Yii::t('easyii/install', 'ReCaptcha secret'), 'visibility' => Setting::VISIBLE_ROOT])->execute(); $db->createCommand()->insert(Setting::tableName(), ['name' => 'toolbar_position', 'value' => 'top', 'title' => Yii::t('easyii/install', 'Frontend toolbar position') . ' ("top" or "bottom")', 'visibility' => Setting::VISIBLE_ROOT])->execute(); }
public function down() { $this->dropTable(models\Admin::tableName()); $this->dropTable(models\LoginForm::tableName()); $this->dropTable(models\Module::tableName()); $this->dropTable(models\Photo::tableName()); $this->dropTable(models\Setting::tableName()); $this->dropTable(Carousel::tableName()); $this->dropTable(catalog\models\Category::tableName()); $this->dropTable(catalog\models\Item::tableName()); $this->dropTable(article\models\Category::tableName()); $this->dropTable(article\models\Item::tableName()); $this->dropTable(Feedback::tableName()); $this->dropTable(File::tableName()); $this->dropTable(gallery\models\Category::tableName()); $this->dropTable(Guestbook::tableName()); $this->dropTable(News::tableName()); $this->dropTable(Page::tableName()); $this->dropTable(Subscriber::tableName()); $this->dropTable(History::tableName()); $this->dropTable(Text::tableName()); }