# HG changeset patch # User Matti Hamalainen # Date 1505717423 -10800 # Node ID d2905ee5ff9c671ad1c4ace295455b3b713f1e71 # Parent f5c1861b48aae4bf1f028939462abb21cb7dd3dd Add logging wrapper function. diff -r f5c1861b48aa -r d2905ee5ff9c slbackup.php --- a/slbackup.php Tue Sep 12 17:00:37 2017 +0300 +++ b/slbackup.php Mon Sep 18 09:50:23 2017 +0300 @@ -18,14 +18,6 @@ $dataBackups = 24; $configFile = "slbackup.cfg"; -if (file_exists($configFile)) - require_once $configFile; -else -{ - error_log("SyntilistaBackup: Configuration file '".$configFile."' does not exist!"); - exit; -} - // // Helper functions @@ -63,9 +55,24 @@ } +function stLog($msg) +{ + error_log("SyntilistaBackup: ".$msg); +} + + // // Actual main code begins here // +if (file_exists($configFile)) + require_once $configFile; +else +{ + stLog("Configuration file '".$configFile."' does not exist!"); + exit; +} + + $errorMsg = ""; $errorSet = FALSE; $index = "file"; @@ -73,7 +80,7 @@ if (!isset($dataSecret) || !isset($dataPath) || $dataSecret == "" || $dataPath == "") { - error_log("SyntilistaBackup: Invalid configuration."); + stLog("Invalid configuration."); exit; }