From 412eec8a5fb6208d361c033653015ff3c74ad3ab Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Thu, 11 Jul 2013 10:59:00 -0400
Subject: [PATCH] - Improved recognition of when a service (Apache, nginx, etc.) was really restarted/reloaded successfully. Checking port 80 is not enough because nginx reloads silently, ignoring faulty configuration files, but returns a value > 0. If we don't check the return value, nginx will refuse to start when someone issues a restart the next time.

---
 server/lib/classes/services.inc.php |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/server/lib/classes/services.inc.php b/server/lib/classes/services.inc.php
index d10abf2..7de5856 100644
--- a/server/lib/classes/services.inc.php
+++ b/server/lib/classes/services.inc.php
@@ -55,9 +55,10 @@
 			$function_name = $this->registered_services[$service_name]['function'];
 			$app->log("Calling function '$function_name' from module '$module_name'.",LOGLEVEL_DEBUG);
 			// call_user_method($function_name,$app->loaded_modules[$module_name],$action);
-			call_user_func(array($app->loaded_modules[$module_name],$function_name),$action);
+			return call_user_func(array($app->loaded_modules[$module_name],$function_name),$action);
 		} else {
 			$app->log("Unable to restart $service_name. Service not registered.",LOGLEVEL_WARNING);
+			return 0;
 		}
 		
 	}

--
Gitblit v1.9.1