PERMISSIONS, MQTT, Maintenance work⤵

This commit is contained in:
Jokob-sk
2023-10-18 22:35:36 +11:00
parent 9dd456bd2c
commit 1a3cf49c00
5 changed files with 34 additions and 53 deletions

View File

@@ -328,9 +328,16 @@ function saveSettings()
$txt = $txt."#-------------------IMPORTANT INFO-------------------#\n";
// open new file and write the new configuration
$newConfig = fopen($fullConfPath, "w") or die("Unable to open file!");
fwrite($newConfig, $txt);
fclose($newConfig);
// Create a temporary file
$tempConfPath = $fullConfPath . ".tmp";
// Write your changes to the temporary file
$tempConfig = fopen($tempConfPath, "w") or die("Unable to open file!");
fwrite($tempConfig, $txt);
fclose($tempConfig);
// Replace the original file with the temporary file
rename($tempConfPath, $fullConfPath);
displayMessage("<br/>Settings saved to the <code>pialert.conf</code> file.<br/><br/>A time-stamped backup of the previous file created. <br/><br/> Reloading...<br/>",
FALSE, TRUE, TRUE, TRUE);