- $handle = fopen (JIRAFEAU_CFG, 'w');
- fwrite ($handle, '<?php' . NL);
- fwrite ($handle,
- '/* ' .
- _ ('This file was generated by the install process. ' .
- 'You can edit it. Please see config.php to understand the ' .
- 'configuration items.') . ' */' . NL);
- foreach ($cfg as $key => $item)
- {
- fwrite ($handle, '$cfg[' . jirafeau_quoted ($key) . '] = ');
- if (is_bool ($item))
- fwrite ($handle, ($item ? 'true' : 'false'));
- else if (is_string ($item))
- fwrite ($handle, jirafeau_quoted ($item));
- else
- fwrite ($handle, 'null');
- fwrite ($handle, ';'.NL);
+ $content = '<?php' . NL;
+ $content .= '/* ' . t ('This file was generated by the install process. ' .
+ 'You can edit it. Please see config.original.php to understand the ' .
+ 'configuration items.') . ' */' . NL;
+ $content .= '$cfg = ' . var_export($cfg, true) . ';';
+
+ $fileWrite = file_put_contents(JIRAFEAU_CFG, $content);
+
+ if (false === $fileWrite) {
+ jirafeau_fatal_error(t('Can not write local configuration file'));