From 5ca959fa688255a8de61f89fe2751eb4d24a6912 Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Tue, 22 Mar 2016 09:22:07 -0400
Subject: [PATCH] fixed typo

---
 server/lib/classes/services.inc.php |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/server/lib/classes/services.inc.php b/server/lib/classes/services.inc.php
index 3f9e6e4..7a8841e 100644
--- a/server/lib/classes/services.inc.php
+++ b/server/lib/classes/services.inc.php
@@ -33,48 +33,51 @@
 	var $registered_services = array();
 	var $delayed_restarts = array();
 	var $debug = false;
-	
-	// This function adds a request for restarting 
+
+	// This function adds a request for restarting
 	// a service at the end of the configuration run.
-	function restartServiceDelayed($service_name,$action = 'restart') {
+	function restartServiceDelayed($service_name, $action = 'restart') {
 		global $app;
 		if(is_array($this->registered_services[$service_name])) {
 			$this->delayed_restarts[$service_name] = $action;
 		} else {
-			$app->log("Unable to add a delayed restart for  '$service_name'. Service '$service_name' is not registered.",LOGLEVEL_WARNING);
+			$app->log("Unable to add a delayed restart for '$service_name'. Service not registered.", LOGLEVEL_WARNING);
 		}
-		
+
 	}
-	
+
 	// This function restarts a service when the function is called
-	function restartService($service_name,$action = 'restart') {
+	function restartService($service_name, $action = 'restart') {
 		global $app;
-		
+
 		if(is_array($this->registered_services[$service_name])) {
-			$module_name = $this->registered_services[$service_name]["module"];
-			$function_name = $this->registered_services[$service_name]["function"];
-			$app->log("Call function '$function_name' in module '$module_name'.",LOGLEVEL_DEBUG);
-			call_user_method($function_name,$app->loaded_modules[$module_name],$action);
+			$module_name = $this->registered_services[$service_name]['module'];
+			$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);
+			return call_user_func(array($app->loaded_modules[$module_name], $function_name), $action);
 		} else {
-			$app->log("Unable to restart $service_name. Service $service_name is not registered.",LOGLEVEL_WARNING);
+			$app->log("Unable to restart $service_name. Service not registered.", LOGLEVEL_WARNING);
+			return array('output' => '', 'retval' => 0);
 		}
-		
+
 	}
-	
+
 	// This function is used to register callback functions for services that can be restarted
-	function registerService($service_name,$module_name, $function_name) {
+	function registerService($service_name, $module_name, $function_name) {
 		global $app;
 		$this->registered_services[$service_name] = array('module' => $module_name, 'function' => $function_name);
-		if($this->debug) $app->log("Registered Service '$service_name' in module '$module_name' for processing function '$function_name'",LOGLEVEL_DEBUG);
+		if($this->debug) $app->log("Registered Service '$service_name' in module '$module_name' for processing function '$function_name'", LOGLEVEL_DEBUG);
 	}
-	
+
 	// This function is called at the end of the server script to restart services.
 	function processDelayedActions() {
 		global $app;
 		foreach($this->delayed_restarts as $service_name => $action) {
-			$this->restartService($service_name,$action);
+			$this->restartService($service_name, $action);
 		}
 	}
 
 }
-?>
\ No newline at end of file
+
+?>

--
Gitblit v1.9.1