public static function generateConfigFiles() { foreach (['app-backend', 'app-frontend'] as $type) { // LOAD APP DATA $config = ArrayHelper::merge([], ModelConfig::getActiveSectionConfigs($type)); $configPath = \Yii::$app->getModule('installation')->getSubdirectories('config'); FileSystem::createFile($configPath . '/' . $type . '.php', $config); } }
/** * Executes the installation manager */ public function execute() { /** @var \atuin\installation\Module $moduleLink */ $moduleLink = \Yii::$app->getModule('installation'); if ($this->checkInstallation()) { throw new ErrorException('Atuin System is already installed. The SystemInstallacion Class should be only instantiated to install the Atuin System.'); } // STEP 1 : CHECK IF MAIN ATUIN SUBDIRECTORY IT'S WRITABLE // hay que chequear también que es writable vendor, noequé carpeta de console para las migrations, que exista composer.phar y si no que intente bajarlo // y nosequé cosas más, podría ser útil hacer un .ini // hay que chequear también que es writable vendor, nosequé carpeta de console para las migrations, que exista composer.phar y si no que intente bajarlo // y nosequé más cosas, podrÃa ser útil hacer un .init para ejecutar desde comando todo a la vez también if (!is_writable($moduleLink->getInstallationDirectory())) { throw new ErrorException('The Atuin base directory it\'s not writable.'); } // STEP 2 : CHECK IF CONFIG AND APPS SUBDIRECTORIES EXIST, IF NOT, CREATE THEM $directories = $moduleLink->getSubdirectories(); foreach ($directories as $dir_key => $directory) { if (!FileSystem::fileSystem()->has($directory)) { FileSystem::fileSystem()->createDir($directory); } } // STEP 3 : INITIALIZE DATABASE CONFIGURATION WITH THE FORM INPUT if ($this->checkDBInstallation() === FALSE) { return; } // STEP 4 : INSTALLING THE BASIC CONFIG AND CORE APPS if ($this->checkAppInstallation() !== TRUE) { return; } // STEP 5 : INITIALIZE USER AND TITLE CONFIGURATION WITH THE FORM INPUT if ($this->checkUserInstallation() === FALSE) { return; } // STEP 6 : CREATE INSTALLED FILE FileSystem::createFile('installation.php', '1'); // STEP 7 : RELOAD PAGE TO GET NEW CONFIG FILES Yii::$app->getResponse()->redirect('@atuin/loginUrl'); }
public function databaseInstallation() { $data = ['components' => ['db' => ['class' => 'yii\\db\\Connection', 'dsn' => 'mysql:host=' . $this->host . ';dbname=' . $this->dbname, 'username' => $this->db_username, 'password' => $this->db_password, 'charset' => $this->charsetList($this->charset)]]]; $configPath = \Yii::$app->getModule('installation')->getSubdirectories('config'); FileSystem::createFile($configPath . '/config-db.php', $data); }