From 4f73710bad5ac924155dddf54b06c832847325ea Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 17 Feb 2020 07:37:44 -0700 Subject: [PATCH] Phrases: Create ../phrases/ folder (if necessary) in save_phrases_xml() function. --- .../resources/functions/save_phrases_xml.php | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/phrases/resources/functions/save_phrases_xml.php b/app/phrases/resources/functions/save_phrases_xml.php index 9acd5315e7..b6cfd85fc4 100644 --- a/app/phrases/resources/functions/save_phrases_xml.php +++ b/app/phrases/resources/functions/save_phrases_xml.php @@ -39,6 +39,9 @@ function save_phrases_xml() { } //create/open new xml file for writing + if (!file_exists($_SESSION['switch']['phrases']['dir']."/".$row['phrase_language']."/phrases/")) { + mkdir($_SESSION['switch']['phrases']['dir']."/".$row['phrase_language']."/phrases/", 0755); + } $xml_path = $_SESSION['switch']['phrases']['dir']."/".$row['phrase_language']."/phrases/".$domain_uuid.".xml"; $fout = fopen($xml_path, "w"); $xml = "\n"; @@ -68,18 +71,22 @@ function save_phrases_xml() { $prev_language = $row['phrase_language']; } + + if ($fout && $xml) { + //output xml & close previous file + $xml .= "\n"; + + fwrite($fout, $xml); + unset($xml); + fclose($fout); + } + } unset($result, $row); - //output xml & close previous file - $xml .= "\n"; - - fwrite($fout, $xml); - unset($xml); - fclose($fout); - //apply settings $_SESSION["reload_xml"] = true; } + ?> \ No newline at end of file