From: Alan Date: Wed, 10 Nov 2021 03:29:46 +0000 (+0800) Subject: getting eventlog - try www-data as thats the most likely location X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=7c956b1ea74995c6e42e3851cf35788fecbb40c3 getting eventlog - try www-data as thats the most likely location --- diff --git a/DataObjects/Events.php b/DataObjects/Events.php index f90debf1..7c4b14d5 100644 --- a/DataObjects/Events.php +++ b/DataObjects/Events.php @@ -476,17 +476,18 @@ class Pman_Core_DataObjects_Events extends DB_DataObject self::$extra_data = $data; } - function logDir() + function logDir($user = false) { $ff = HTML_FlexyFramework::get(); - if (function_exists('posix_getpwuid')) { - $uinfo = posix_getpwuid( posix_getuid () ); - - $user = $uinfo['name']; - } else { - $user = getenv('USERNAME'); // windows. - } - + if ($user == false) { + if (function_exists('posix_getpwuid')) { + $uinfo = posix_getpwuid( posix_getuid () ); + + $user = $uinfo['name']; + } else { + $user = getenv('USERNAME'); // windows. + } + } if (!empty($ff->Pman['storedir'])) { @@ -646,7 +647,12 @@ class Pman_Core_DataObjects_Events extends DB_DataObject $file = $logdir. $date. $this->id . ".json"; if (!file_exists(dirname($file))) { - return false; + + // try looking www-dir.. + $file = $this->logDir('www-data'). $date. $this->id . ".json"; + if (!file_exists(dirname($file))) { + return false; + } } return $file;