From 33e2c95c69b405f36caf9013ff9a256e6edf9500 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Mon, 11 Feb 2013 08:15:44 -0500 Subject: [PATCH] - htpasswd_stats file was not readable for apache user. --- server/mods-available/monitor_core_module.inc.php | 66 ++++++++++++++++++--------------- 1 files changed, 36 insertions(+), 30 deletions(-) diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php index bfb03be..63a813c 100644 --- a/server/mods-available/monitor_core_module.inc.php +++ b/server/mods-available/monitor_core_module.inc.php @@ -117,13 +117,17 @@ } private function _monitorEmailQuota() { - global $app; + global $app, $conf; /* * This monitoring is expensive, so do it only every 15 minutes */ $min = @date('i'); if ($min % 15 != 0) return; + + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + if($mail_config['mailbox_quota_stats'] == 'n') return; /* @@ -134,7 +138,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -159,7 +163,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -184,7 +188,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -209,7 +213,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -234,7 +238,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -259,7 +263,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -283,7 +287,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -307,7 +311,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -332,7 +336,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -357,7 +361,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -382,7 +386,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -420,7 +424,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -445,7 +449,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -470,7 +474,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -505,7 +509,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -530,7 +534,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -556,7 +560,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -581,7 +585,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -606,7 +610,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -631,7 +635,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -656,7 +660,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -681,7 +685,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -704,12 +708,12 @@ $res = $this->_tools->monitorISPCCronLog(); //* Ensure that output is encoded so that it does not break the serialize - $res['data']['output'] = htmlentities($res['data']['output']); + if(is_array($res) && isset($res['data'])) $res['data'] = htmlentities($res['data']); /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -734,7 +738,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -759,7 +763,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -784,7 +788,7 @@ /* * Insert the data into the database */ - $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' . + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . 'VALUES (' . $res['server_id'] . ', ' . "'" . $app->dbmaster->quote($res['type']) . "', " . @@ -807,8 +811,10 @@ private function _delOldRecords($type, $serverId) { global $app; - $now = time(); - $old = $now - (4 * 60); // 4 minutes + // $now = time(); + // $old = $now - (4 * 60); // 4 minutes + $old = 'UNIX_TIMESTAMP() - 240'; + /* * ATTENTION if i do NOT pay attention of the server id, i delete all data (of the type) * of ALL servers. This means, if i have a multiserver-environment and a server has a -- Gitblit v1.9.1