From 7eade0da5ec04ec86a89aed3c98e27cba3dae491 Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Thu, 07 May 2015 08:33:08 -0400
Subject: [PATCH] avoid the second use of query in install.php
---
server/lib/classes/monitor_tools.inc.php | 35 ++++++++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 98a8c3f..3b451cd 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -62,6 +62,21 @@
$mainver = array_filter($mainver);
$mainver = current($mainver).'.'.next($mainver);
switch ($mainver){
+ case "15.04":
+ $relname = "(Vivid Vervet)";
+ break;
+ case "14.10":
+ $relname = "(Utopic Unicorn)";
+ break;
+ case "14.04":
+ $relname = "(Trusty Tahr)";
+ break;
+ case "13.10":
+ $relname = "(Saucy Salamander)";
+ break;
+ case "13.04":
+ $relname = "(Raring Ringtail)";
+ break;
case "12.10":
$relname = "(Quantal Quetzal)";
break;
@@ -201,6 +216,16 @@
$distver = '5.3';
$distid = 'centos53';
$distbaseid = 'fedora';
+ } elseif(stristr($content, 'CentOS Linux release 6')) {
+ $distname = 'CentOS';
+ $distver = 'Unknown';
+ $distid = 'centos53';
+ $distbaseid = 'fedora';
+ } elseif(stristr($content, 'CentOS Linux release 7')) {
+ $distname = 'CentOS';
+ $distver = 'Unknown';
+ $distid = 'centos53';
+ $distbaseid = 'fedora';
} else {
$distname = 'Redhat';
$distver = 'Unknown';
@@ -237,7 +262,7 @@
$server_id = intval($conf['server_id']);
/** get the "active" Services of the server from the DB */
- $services = $app->db->queryOneRecord('SELECT * FROM server WHERE server_id = ' . $server_id);
+ $services = $app->db->queryOneRecord('SELECT * FROM server WHERE server_id = ?', $server_id);
/*
* If the DB is down, we have to set the db to "yes".
* If we don't do this, then the monitor will NOT monitor, that the db is down and so the
@@ -648,12 +673,12 @@
*/
$sql = 'DELETE FROM monitor_data ' .
'WHERE ' .
- ' type =' . "'" . $app->dbmaster->quote($type) . "' " .
+ ' type = ?' .
'AND ' .
- ' created < ' . $old . ' ' .
+ ' created < ? ' .
'AND ' .
- ' server_id = ' . $serverId;
- $app->dbmaster->query($sql);
+ ' server_id = ?';
+ $app->dbmaster->query($sql, $type, $old, $serverId);
}
public function send_notification_email($template, $placeholders, $recipients) {
--
Gitblit v1.9.1