From 17d53616b36fef3b753fc408bfc600f360673333 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Fri, 22 Apr 2016 02:14:43 -0400
Subject: [PATCH] Merge branch 'master' into 'stable-3.1'

---
 server/lib/classes/cron.d/100-monitor_mongodb.inc.php~      |    0 
 server/lib/classes/monitor_tools.inc.php                    |    4 +
 interface/web/admin/templates/server_config_rescue_edit.htm |    2 +
 server/mods-available/rescue_core_module.inc.php            |   59 +++++++++++++++--------------
 interface/web/sites/database_user_edit.php                  |    5 +-
 server/plugins-available/mongo_clientdb_plugin.inc.php~     |    0 
 interface/web/monitor/lib/module.conf.php                   |    3 +
 interface/web/monitor/show_data.php                         |    2 +
 8 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/interface/web/admin/templates/server_config_rescue_edit.htm b/interface/web/admin/templates/server_config_rescue_edit.htm
index 8bb9e3b..435449b 100644
--- a/interface/web/admin/templates/server_config_rescue_edit.htm
+++ b/interface/web/admin/templates/server_config_rescue_edit.htm
@@ -17,12 +17,14 @@
                     {tmpl_var name='do_not_try_rescue_httpd'}
                 </div>
             </div>
+<!--
             <div class="form-group">
                 <label class="col-sm-3 control-label">{tmpl_var name='do_not_try_rescue_mongodb_txt'}</label>
                 <div class="col-sm-9">
                     {tmpl_var name='do_not_try_rescue_mongodb'}
                 </div>
             </div>
+-->
             <div class="form-group">
                 <label class="col-sm-3 control-label">{tmpl_var name='do_not_try_rescue_mysql_txt'}</label>
                 <div class="col-sm-9">
diff --git a/interface/web/monitor/lib/module.conf.php b/interface/web/monitor/lib/module.conf.php
index 964d3c8..c0719e7 100644
--- a/interface/web/monitor/lib/module.conf.php
+++ b/interface/web/monitor/lib/module.conf.php
@@ -196,11 +196,12 @@
 	'link' => 'monitor/show_data.php?type=fail2ban',
 	'html_id' => 'fai2ban');
 
+/*
 $items[] = array( 'title'  => "Show MongoDB-Log",
 	'target'  => 'content',
 	'link' => 'monitor/show_data.php?type=mongodb',
 	'html_id' => 'mongodb');
-
+*/
 $items[] = array( 'title'  => "Show IPTables",
 	'target'  => 'content',
 	'link' => 'monitor/show_data.php?type=iptables',
diff --git a/interface/web/monitor/show_data.php b/interface/web/monitor/show_data.php
index f6940cf..80f246e 100644
--- a/interface/web/monitor/show_data.php
+++ b/interface/web/monitor/show_data.php
@@ -138,6 +138,7 @@
 	$description = '';
 	$add_padding = true;
 	break;
+/*
 case 'mongodb':
 	$template = 'templates/show_data.htm';
 	$output .= $app->tools_monitor->showMongoDB();
@@ -145,6 +146,7 @@
 	$title = $app->lng("monitor_title_mongodb_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
 	$description = '';
 	break;
+*/
 case 'iptables':
 	$template = 'templates/show_data.htm';
 	$output .= $app->tools_monitor->showIPTables();
diff --git a/interface/web/sites/database_user_edit.php b/interface/web/sites/database_user_edit.php
index a7bee2b..02ef7bf 100644
--- a/interface/web/sites/database_user_edit.php
+++ b/interface/web/sites/database_user_edit.php
@@ -169,10 +169,11 @@
 		/* prepare password for MongoDB */
 		// TODO: this still doens't work as when only the username changes we have no database_password.
 		// taking the one from oldData doesn't work as it's encrypted...shit!
+/*
 		$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
 
 		$this->dataRecord['server_id'] = 0; // we need this on all servers
-
+*/
 		parent::onBeforeUpdate();
 	}
 
@@ -206,7 +207,7 @@
 		$this->dataRecord['server_id'] = 0; // we need this on all servers
 
 		/* prepare password for MongoDB */
-		$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
+//		$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
 
 		parent::onBeforeInsert();
 	}
diff --git a/server/lib/classes/cron.d/100-monitor_mongodb.inc.php b/server/lib/classes/cron.d/100-monitor_mongodb.inc.php~
similarity index 100%
rename from server/lib/classes/cron.d/100-monitor_mongodb.inc.php
rename to server/lib/classes/cron.d/100-monitor_mongodb.inc.php~
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 9493937..8d71d9b 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -370,14 +370,16 @@
 				$state = 'error'; // because service is down
 			}
 		}
+/*
 		$data['mongodbserver'] = -1;
 		if ($this->_checkTcp('localhost', 27017)) {
 			$data['mongodbserver'] = 1;
 		} else {
 			$data['mongodbserver'] = 0;
+*/
 			//$state = 'error'; // because service is down
 			/* TODO!!! check if this is a mongodbserver at all, otherwise it will always throw an error state!!! */
-		}
+//		}
 
 		/*
 		 * Return the Result
diff --git a/server/mods-available/rescue_core_module.inc.php b/server/mods-available/rescue_core_module.inc.php
index 5698273..5e8f3db 100644
--- a/server/mods-available/rescue_core_module.inc.php
+++ b/server/mods-available/rescue_core_module.inc.php
@@ -97,7 +97,7 @@
 		/*
 		 * rescue MongoDB if needed
 		 */
-		$this->_rescueMongoDB();
+//		$this->_rescueMongoDB();
 
 		/*
 		 * rescue mysql if needed (maybe httpd depends on mysql, so try this first!)
@@ -311,42 +311,43 @@
 		$this->_rescueDaemon($daemon);
 	}
 
+
 	/**
 	 * restarts MongoDB, if needed
 	 */
-	private function _rescueMongoDB(){
-		global $app, $conf;
+//	private function _rescueMongoDB(){
+//		global $app, $conf;
 
 		/*
 		 * do nothing, if it is not allowed to rescue mysql
 		 */
-		if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) == 'y')){
-			return;
-		}
+//		if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) == 'y')){
+//			return;
+//		}
 
 		/*
 		 * if the service is up and running, or the service is not installed there is nothing to do...
 		 */
-		if ($this->_monitoringData[0][0]['data']['mongodbserver'] != 0){
-			/* Clear the try counter, because we do not have to try to rescue the service */
-			$this->_rescueData['mongodbserver']['try_counter'] = 0;
-			return;
-		}
+//		if ($this->_monitoringData[0][0]['data']['mongodbserver'] != 0){
+//			/* Clear the try counter, because we do not have to try to rescue the service */
+//			$this->_rescueData['mongodbserver']['try_counter'] = 0;
+//			return;
+//		}
 
 		/*
 		 * OK, the service is installed and down.
 		 * Maybe this is because of a restart of the service by the admin.
 		 * This means, we check the data 1 minute ago
 		 */
-		if ((!isset($this->_monitoringData[1][0]['data']['mongodbserver'])) ||
-			((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){
+//		if ((!isset($this->_monitoringData[1][0]['data']['mongodbserver'])) ||
+//			((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){
 			/*
 			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
 			 * This means, it could be, that the admin is restarting the server.
 			 * We wait one more minute...
 			 */
-			return;
-		}
+//			return;
+//		}
 
 		/*#####
 		 * The service is down and it was down 1 minute ago.
@@ -354,28 +355,28 @@
 		 *#####*/
 
 		/* Get the try counter */
-		$tryCount = (!isset($this->_rescueData['mongodbserver']['try_counter']))? 1 : $this->_rescueData['mongodbserver']['try_counter'] + 1;
+//		$tryCount = (!isset($this->_rescueData['mongodbserver']['try_counter']))? 1 : $this->_rescueData['mongodbserver']['try_counter'] + 1;
 
 		/* Set the new try counter */
-		$this->_rescueData['mongodbserver']['try_counter'] = $tryCount;
+//		$this->_rescueData['mongodbserver']['try_counter'] = $tryCount;
 
 		/* if 5 times will not work, we have to give up... */
-		if ($tryCount > 5){
-			$app->log('MongoDB is down! Rescue will not help!', LOGLEVEL_ERROR);
-			return;
-		}
+//		if ($tryCount > 5){
+//			$app->log('MongoDB is down! Rescue will not help!', LOGLEVEL_ERROR);
+//			return;
+//		}
 
 
-		$app->log('MongoDB is down! Try rescue MongoDB (try:' . $tryCount . ')...', LOGLEVEL_WARN);
+//		$app->log('MongoDB is down! Try rescue MongoDB (try:' . $tryCount . ')...', LOGLEVEL_WARN);
 
-		if(is_file($conf['init_scripts'] . '/' . 'mongodb')) {
-			$daemon = 'mongodb';
-		} else {
-			$daemon = 'mongodb';
-		}
+//		if(is_file($conf['init_scripts'] . '/' . 'mongodb')) {
+//			$daemon = 'mongodb';
+//		} else {
+//			$daemon = 'mongodb';
+//		}
 
-		$this->_rescueDaemon($daemon);
-	}
+//		$this->_rescueDaemon($daemon);
+//	}
 
 	/**
 	 * restarts mysql, if needed
diff --git a/server/plugins-available/mongo_clientdb_plugin.inc.php b/server/plugins-available/mongo_clientdb_plugin.inc.php~
similarity index 100%
rename from server/plugins-available/mongo_clientdb_plugin.inc.php
rename to server/plugins-available/mongo_clientdb_plugin.inc.php~

--
Gitblit v1.9.1