Read all database settings
This commit is contained in:
@@ -58,11 +58,21 @@ class HRCCommand extends Command
|
||||
file_put_contents($result_file, json_encode($result));
|
||||
}
|
||||
|
||||
private function getCoreConfig($name)
|
||||
{
|
||||
$config = parse_ini_file(mb_strtolower(file_get_contents(CORE_PATH . '/../../db.ini')));
|
||||
return $config[$name];
|
||||
}
|
||||
|
||||
public function initDB()
|
||||
{
|
||||
$code = $this->option('unn');
|
||||
|
||||
DB::disconnect('mysql');
|
||||
Config::set('database.connections.mysql.username', $this->getCoreConfig('user'));
|
||||
Config::set('database.connections.mysql.password', $this->getCoreConfig('password'));
|
||||
Config::set('database.connections.mysql.host', $this->getCoreConfig('server'));
|
||||
Config::set('database.connections.mysql.port', $this->getCoreConfig('port'));
|
||||
Config::set('database.connections.mysql.database', $code);
|
||||
DB::reconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user