'any', 'requestData' => [] ]; } public function handler() { if(defined('MYSQL_HOST')) { throw new Exception(ERRORS::INIT_SETTINGS_DONE); } $dbHost = Controller::request('dbHost'); $dbName = Controller::request('dbName'); $dbUser = Controller::request('dbUser'); $dbPass = Controller::request('dbPassword'); RedBean::setup('mysql:host=' . $dbHost, $dbUser, $dbPass); if($dbName) { RedBean::addDatabase($dbName, 'mysql:host='. $dbHost . ';dbname=' . $dbName, $dbUser, $dbPass); RedBean::selectDatabase($dbName); if(!RedBean::testConnection()) { throw new Exception(ERRORS::DATABASE_CONNECTION); } } else { $dbName = 'opensupports_' . Hashing::generateRandomNumber(100, 999); RedBean::exec('CREATE DATABASE ' . $dbName); RedBean::addDatabase($dbName, 'mysql:host='. $dbHost . ';dbname=' . $dbName, $dbUser, $dbPass); RedBean::selectDatabase($dbName); if(!RedBean::testConnection()) { throw new Exception(ERRORS::DATABASE_CREATION); } } $configFile = fopen('config.php', 'w+') or die(ERRORS::INVALID_FILE); $content = '