From 49441bdd0f3ff75d5092d5b832b97ea722a66363 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Fri, 01 Jul 2016 03:53:30 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

---
 server/server.php |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/server/server.php b/server/server.php
index 4479b14..689cb17 100644
--- a/server/server.php
+++ b/server/server.php
@@ -29,6 +29,25 @@
 
 define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
 require SCRIPT_PATH."/lib/config.inc.php";
+
+// Check whether another instance of this script is already running
+if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock')) {
+	clearstatcache();
+	$pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock'));
+	if(preg_match('/^[0-9]+$/', $pid)) {
+		if(file_exists('/proc/' . $pid)) {
+			print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n";
+			exit;
+		}
+	}
+	print @date('d.m.Y-H:i').' - WARNING - There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.' . "\n";
+}
+
+// Set Lockfile
+@file_put_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', getmypid());
+
+if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock' . "\n";
+
 require SCRIPT_PATH."/lib/app.inc.php";
 
 $app->setCaller('server');
@@ -124,24 +143,6 @@
 	// we do not need this variable anymore
 	unset($tmp);
 }
-
-
-// Check whether another instance of this script is already running
-if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock')) {
-	clearstatcache();
-	$pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock'));
-	if(preg_match('/^[0-9]+$/', $pid)) {
-		if(file_exists('/proc/' . $pid)) {
-			$app->log('There is already an instance of server.php running with pid ' . $pid . '.', LOGLEVEL_DEBUG);
-			exit;
-		}
-	}
-	$app->log('There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.', LOGLEVEL_WARN);
-}
-
-// Set Lockfile
-@file_put_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', getmypid());
-$app->log('Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', LOGLEVEL_DEBUG);
 
 /** Do we need to start the core-modules */
 

--
Gitblit v1.9.1