From f34a5224a03da268caf3c241e42b1018642b1359 Mon Sep 17 00:00:00 2001
From: Axel Hahn <axel.hahn@iml.unibe.ch>
Date: Mon, 20 Apr 2015 15:13:47 +0200
Subject: [PATCH] - added cronjob to cache branches and tags - fixed current
 process user in actionlog class

---
 public_html/deployment/classes/actionlog.class.php | 2 +-
 shellscripts/cron_cache_gitbranches.php            | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/public_html/deployment/classes/actionlog.class.php b/public_html/deployment/classes/actionlog.class.php
index 2a123e67..a094e1e5 100644
--- a/public_html/deployment/classes/actionlog.class.php
+++ b/public_html/deployment/classes/actionlog.class.php
@@ -49,7 +49,7 @@ class Actionlog {
             $this->_sUser = $_SERVER["PHP_AUTH_USER"] . " (web)";
         } else {
             $this->_sIP = 'local';
-            $this->_sUser = get_current_user() . " (system)";
+            $this->_sUser = posix_getpwuid(posix_geteuid()) . " (system)";
         }
     }
 
diff --git a/shellscripts/cron_cache_gitbranches.php b/shellscripts/cron_cache_gitbranches.php
index 837efb1d..9e2c37e8 100644
--- a/shellscripts/cron_cache_gitbranches.php
+++ b/shellscripts/cron_cache_gitbranches.php
@@ -10,6 +10,11 @@
 
 $sDocroot = (dirname(__dir__)) . "/public_html";
 
+$processUser = posix_getpwuid(posix_geteuid());
+if ($processUser['name']=="root"){
+    die("Do not start the script as user root\n");
+};
+
 require_once("$sDocroot/deployment/classes/logger.class.php");
 global $oCLog;
 $oCLog = new logger();
-- 
GitLab