summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/etc/inc/config.lib.inc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc
index 1b2cc32..28a7a36 100644
--- a/src/etc/inc/config.lib.inc
+++ b/src/etc/inc/config.lib.inc
@@ -485,7 +485,7 @@ function convert_config() {
* process, them renaming the temporary file over the original.
* INPUTS
* $filename - string containing the filename of the file to write
- * $content - string containing the file content to write to file
+ * $content - string or array containing the file content to write to file
* $force_binary - boolean denoting whether we should force binary
* mode writing.
* RESULT
@@ -500,7 +500,15 @@ function safe_write_file($file, $content, $force_binary = false) {
// Unable to open temporary file for writing
return false;
}
- if (!fwrite($fd, $content)) {
+ if (is_array($content)) {
+ foreach ($content as $line) {
+ if (!fwrite($fd, $line . "\n")) {
+ // Unable to write to temporary file
+ fclose($fd);
+ return false;
+ }
+ }
+ } elseif (!fwrite($fd, $content)) {
// Unable to write to temporary file
fclose($fd);
return false;
OpenPOWER on IntegriCloud