From c9ff4f26b5b99aad1668723d965b6478e6da9642 Mon Sep 17 00:00:00 2001 From: nagyrobi Date: Mon, 23 Sep 2013 14:19:55 +0200 Subject: Update asterisk_log.php Log path restored to default, on every architecture; trim and clear should return an infobox now. --- config/asterisk/asterisk_log.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'config/asterisk') diff --git a/config/asterisk/asterisk_log.php b/config/asterisk/asterisk_log.php index b8d454bd..42cf8e8b 100644 --- a/config/asterisk/asterisk_log.php +++ b/config/asterisk/asterisk_log.php @@ -50,10 +50,10 @@ $pgtitle = array(gettext("Status"),gettext("Asterisk Log")); include("head.inc"); /* Path to Asterisk log file */ -if ($g['platform'] == "nanobsd") - $log = "/tmp/asterisk.log"; -else - $log = "/var/log/asterisk/messages"; +//if ($g['platform'] == "nanobsd") +// $log = "/tmp/asterisk.log"; +//else +$log = "/var/log/asterisk/messages"; ?> @@ -66,18 +66,27 @@ $file = $_SERVER["SCRIPT_NAME"]; $break = Explode('/', $file); $pfile = $break[count($break) - 1]; -if ($cmd == "trim") { - $trimres=shell_exec("tail -50 '$log' > /tmp/trimmed.csv; rm '$log'; mv /tmp/trimmed.csv '$log'; chmod 666 '$log'"); -} -if ($cmd == "clear") { - $trimres=shell_exec("rm '$log'; touch '$log'; chmod 666 '$log'"); +if (file_exists($log) { + if ($cmd == "trim") { + $trimres=shell_exec("tail -50 '$log' > /tmp/trimmed_asterisk.log && rm '$log' && mv /tmp/trimmed_asterisk.log '$log' && chown asterisk:asterisk '$log' && chmod g+w '$log'"); + header( 'Location: asterisk_log.php?savemsg=Log+trimmed.') ; + } + if ($cmd == "clear") { + $trimres=shell_exec("rm '$log' && touch '$log' && chown asterisk:asterisk '$log' && chmod g+w '$log'"); + header( 'Location: asterisk_log.php?savemsg=Log+cleared.') ; + } } - ?> +
@@ -125,7 +134,7 @@ if ($cmd == "clear") { This log is lost when rebooting the system."; + echo "
This log may be lost when rebooting the system."; ?> -- cgit v1.2.3