getConnection(); $connection->exec("SET NAMES UTF8"); $database = new \Thelia\Install\Database($connection); if (isset($_POST['database'])) { $_SESSION['install']['database'] = $_POST['database']; } if (isset($_POST['database_create']) && $_POST['database_create'] != "") { $_SESSION['install']['database'] = $_POST['database_create']; $database->createDatabase($_SESSION['install']['database']); } $database->insertSql($_SESSION['install']['database']); if (!file_exists(THELIA_CONF_DIR . "/database.yml")) { $fs = new \Symfony\Component\Filesystem\Filesystem(); $sampleConfigFile = THELIA_CONF_DIR . "/database.yml.sample"; $configFile = THELIA_CONF_DIR . "/database.yml"; $fs->copy($sampleConfigFile, $configFile, true); $configContent = file_get_contents($configFile); $configContent = str_replace("%DRIVER%", "mysql", $configContent); $configContent = str_replace("%USERNAME%", $_SESSION['install']['username'], $configContent); $configContent = str_replace("%PASSWORD%", $_SESSION['install']['password'], $configContent); $configContent = str_replace( "%DSN%", sprintf( "mysql:host=%s;dbname=%s;port=%s", $_SESSION['install']['host'], $_SESSION['install']['database'], $_SESSION['install']['port'] ), $configContent ); file_put_contents($configFile, $configContent); } } catch(\exception $ex) { ?>
Sorry, an unexpected error occured: %err
Error details:
%details
', [ '%err' => $ex->getMessage(), '%details' => nl2br($ex->getTraceAsString()) ] ); ?>