From 9cdf9d9ee39bade1b6c242ca4fb458a1de2c76a7 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Tue, 16 Jul 2013 10:06:24 -0400
Subject: [PATCH] - Display/email reason for service restart/reload failure (if init script doesn't suppress error messages).

---
 server/server.php |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/server/server.php b/server/server.php
index 6a6d0de..6e7489d 100644
--- a/server/server.php
+++ b/server/server.php
@@ -62,9 +62,19 @@
 
 	// Set the loglevel
 	$conf['log_priority'] = intval($conf['serverconfig']['server']['loglevel']);
+	
+	// Set level from which admin should be notified by email
+	if(!isset($conf['serverconfig']['server']['admin_notify_events']) || $conf['serverconfig']['server']['admin_notify_events'] == '') $conf['serverconfig']['server']['admin_notify_events'] = 3;
+	$conf['admin_notify_priority'] = intval($conf['serverconfig']['server']['admin_notify_events']);
 
 	// we do not need this variable anymore
 	unset($server_db_record);
+	
+	// retrieve admin email address for notifications
+	$sys_ini = $app->dbmaster->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1");
+	$conf['sys_ini'] = $app->ini_parser->parse_ini_string(stripslashes($sys_ini['config']));
+	$conf['admin_mail'] = $conf['sys_ini']['mail']['admin_mail'];
+	unset($sys_ini);
 	
 	/*
 	 * Save the rescue-config, maybe we need it (because the database is down)
@@ -193,8 +203,8 @@
 	$app->uses('modules,plugins,file,services');
 	// Load the modules that are im the mods-core folder
 	$app->modules->loadModules('core');
-	// Load the plugins that are in the plugins-core folder
-	$app->plugins->loadPlugins('core');
+	// Load the plugins that are in the f folder
+	//$app->plugins->loadPlugins('core');
 }
 
 

--
Gitblit v1.9.1