19declare(strict_types=1);
41 $this->
writeDataToFile($content, self::CHATROOM_CLIENT_CONFIG_FILENAME);
54 $type =
$DIC[
'ilClientIniFile']->readVariable(
'db',
'type');
63 $settings[
'database'] = [
65 'host' =>
$DIC[
'ilClientIniFile']->readVariable(
'db',
'host'),
67 'name' =>
$DIC[
'ilClientIniFile']->readVariable(
'db',
'name'),
68 'user' =>
$DIC[
'ilClientIniFile']->readVariable(
'db',
'user'),
69 'pass' =>
$DIC[
'ilClientIniFile']->readVariable(
'db',
'pass')
72 return json_encode($settings, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
84 if (!fwrite($handle, $content)) {
85 throw new RuntimeException(
'Cannot write to file');
100 throw new RuntimeException(
'Directory cannot be created');
113 $this->
writeDataToFile($content, self::CHATROOM_SERVER_CONFIG_FILENAME);
121 unset($settings[
'ilias_proxy'], $settings[
'client_proxy'], $settings[
'ilias_url'], $settings[
'client_url']);
123 return json_encode($settings, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
readVariable(string $a_group, string $a_var_name)
reads a single variable from a group
const string CHATROOM_SERVER_CONFIG_FILENAME
writeDataToFile(string $content, string $filename)
Writes $content to file named by $filename.
createDataDirIfNotExists()
Creates a data directory for configuration files, if the directory does not already exists.
getServerFileContent(array $settings)
Get the server config file contetn as json encoded string.
const string CHATROOM_DATA_DIR
createClientConfigFile(array $settings)
Creates a client config file and saves it to the chatroom data directory.
const string CHATROOM_CLIENT_CONFIG_FILENAME
getClientFileContent(array $settings)
Get the client config file content as json encoded string.
createServerConfigFile(array $settings)
Creates a server config file and saves it to the chatroom data directory.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)