From df0207cea9dbed0d0816f5c89cd6a9827936eadb Mon Sep 17 00:00:00 2001 From: Ermal Date: Sat, 5 Jan 2013 17:02:27 +0000 Subject: Since php_sapi_name() is useless in pfSense test if argc has been registered or not to avoid warnings on bootup --- etc/inc/config.lib.inc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'etc') diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index e0d5acb..f496562 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -494,10 +494,17 @@ function write_config($desc="Unknown", $backup = true) { log_error("WARNING! Configuration written on bootup. This can cause stray openvpn and load balancing items in config.xml"); */ - if (!session_id()) - session_start(); - $username = empty($_SESSION["Username"]) ? "(system)" : $_SESSION['Username']; - session_commit(); + if (!isset($argc)) { + if (!session_id()) + session_start(); + $username = empty($_SESSION["Username"]) ? "(system)" : $_SESSION['Username']; + session_commit(); + } else { + if (empty($_ENV['USER']) || $_ENV['USER'] == "root") + $username = "(system)"; + else + $username = $_ENV['USER']; + } if (!empty($_SERVER['REMOTE_ADDR'])) $username .= '@' . $_SERVER['REMOTE_ADDR']; -- cgit v1.1