public function actionFinal() { $model = new FinalStep(); $model->serverName = Yii::$app->request->serverName; if (extension_loaded('memcached') || extension_loaded('memcache')) { $model->cacheClass = 'yii\\caching\\MemCache'; if (extension_loaded('memcached')) { $model->useMemcached = true; } } if (Yii::$app->request->serverPort !== 80) { $model->serverPort = Yii::$app->request->serverPort; } if ($model->load(Yii::$app->request->post()) && $model->validate()) { if (InstallerHelper::writeCommonConfig($model) && InstallerHelper::updateConfigurables()) { return $this->redirect(['complete']); } else { Yii::$app->session->setFlash('warning', Yii::t('app', 'Unable to write common-local.php')); } } $cacheClasses = ['yii\\caching\\FileCache', 'yii\\caching\\MemCache', 'yii\\caching\\XCache', 'yii\\caching\\ZendDataCache', 'yii\\caching\\ApcCache']; return $this->render('final', ['model' => $model, 'cacheClasses' => $cacheClasses]); }
private function finalStep() { $model = new FinalStep(); Yii::setAlias('@webroot', Yii::getAlias('@app/web/')); foreach ($model->attributes() as $attribute) { if ($attribute !== 'useMemcached') { $model->setAttributes([$attribute => $this->prompt("-> {$attribute}", ['required' => true, 'default' => $model->{$attribute}])]); } else { $model->useMemcached = $this->confirm("Use memcached extension?", false); } } if (getenv('DP2_SERVER_NAME')) { $model->serverName = getenv('DP2_SERVER_NAME'); } if (InstallerHelper::writeCommonConfig($model) && InstallerHelper::updateConfigurables()) { file_put_contents(Yii::getAlias('@app/installed.mark'), '1'); $this->stdout("Installation complete!\n", Console::FG_GREEN); } else { $this->stderr("Unable to write configs!\n", Console::FG_RED); } return 0; }