From e45f6d6cfb2ea7170a47931260797dfdb1829b22 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 09 Dec 2008 16:56:34 -0500
Subject: [PATCH] Enabled status field in sys datalog processing scripts.

---
 interface/web/admin/datalog_list.php          |    1 +
 server/lib/classes/modules.inc.php            |    3 +++
 server/server.php                             |    2 +-
 interface/web/admin/list/log.list.php         |    3 ---
 interface/web/admin/templates/syslog_list.htm |    6 +++---
 interface/web/admin/log_list.php              |    2 ++
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/interface/web/admin/datalog_list.php b/interface/web/admin/datalog_list.php
index 8db6a09..d44ea01 100644
--- a/interface/web/admin/datalog_list.php
+++ b/interface/web/admin/datalog_list.php
@@ -46,6 +46,7 @@
 
 $app->uses('listform_actions');
 //$app->listform_actions->SQLExtWhere = "wb = 'W'";
+$app->listform_actions->SQLOrderBy = "ORDER BY tstamp DESC, datalog_id DESC";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/admin/list/log.list.php b/interface/web/admin/list/log.list.php
index 4b1f316..aa3ad5d 100644
--- a/interface/web/admin/list/log.list.php
+++ b/interface/web/admin/list/log.list.php
@@ -39,9 +39,6 @@
 //* Enable auth
 $liste['auth']				= 'no';
 
-$liste['sort_field'] 		= 'tstamp';
-$liste['sort_direction'] 	= 'ASC';
-
 /*****************************************************
 * Suchfelder
 *****************************************************/
diff --git a/interface/web/admin/log_list.php b/interface/web/admin/log_list.php
index 1e44784..890c90b 100644
--- a/interface/web/admin/log_list.php
+++ b/interface/web/admin/log_list.php
@@ -47,6 +47,8 @@
 $app->uses('listform_actions');
 //$app->listform_actions->SQLExtWhere = "wb = 'W'";
 
+$app->listform_actions->SQLOrderBy = "ORDER BY tstamp DESC, syslog_id DESC";
+
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/admin/templates/syslog_list.htm b/interface/web/admin/templates/syslog_list.htm
index a4fdd01..45f2a38 100644
--- a/interface/web/admin/templates/syslog_list.htm
+++ b/interface/web/admin/templates/syslog_list.htm
@@ -15,10 +15,10 @@
           </tr>
           <tr>
             <td class="tbl_col_tstamp">&nbsp;</td>
-            <td class="tbl_col_server_id"><select name="search_server_id" onChange="submitForm('pageForm','admin/syslog_list.php');">{tmpl_var name='search_server_id'}</select></td>
-            <td class="tbl_col_loglevel"><select name="search_loglevel" onChange="submitForm('pageForm','admin/syslog_list.php');">{tmpl_var name='search_loglevel'}</select></td>
+            <td class="tbl_col_server_id"><select name="search_server_id" onChange="submitForm('pageForm','admin/log_list.php');">{tmpl_var name='search_server_id'}</select></td>
+            <td class="tbl_col_loglevel"><select name="search_loglevel" onChange="submitForm('pageForm','admin/log_list.php');">{tmpl_var name='search_loglevel'}</select></td>
             <td class="tbl_col_message"><input type="text" name="search_message" value="{tmpl_var name='search_message'}" /></td>
-            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','admin/syslog_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','admin/log_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
           </tr>
         </thead>
         <tbody>
diff --git a/server/lib/classes/modules.inc.php b/server/lib/classes/modules.inc.php
index 8f4638c..9a1310b 100644
--- a/server/lib/classes/modules.inc.php
+++ b/server/lib/classes/modules.inc.php
@@ -144,8 +144,10 @@
 					$this->raiseTableHook($d["dbtable"],$d["action"],$data);
 					$app->dbmaster->query("DELETE FROM sys_datalog WHERE datalog_id = ".$d["datalog_id"]);
 					$app->log("Deleting sys_datalog ID ".$d["datalog_id"],LOGLEVEL_DEBUG);
+					$app->db->query("UPDATE sys_datalog SET status = 'ok' WHERE datalog_id = ".$d["datalog_id"]);
 				} else {
 					$app->log("Error in Repliction, changes were not processed.",LOGLEVEL_ERROR);
+					$app->db->query("UPDATE sys_datalog SET status = 'error' WHERE datalog_id = ".$d["datalog_id"]);
 				}
 			}
 			
@@ -158,6 +160,7 @@
 				$this->raiseTableHook($rec["dbtable"],$rec["action"],$data);
 				$app->db->query("DELETE FROM sys_datalog WHERE datalog_id = ".$rec["datalog_id"]);
 				$app->log("Deleting sys_datalog ID ".$rec["datalog_id"],LOGLEVEL_DEBUG);
+				$app->db->query("UPDATE sys_datalog SET status = 'ok' WHERE datalog_id = ".$rec["datalog_id"]);
 			}
 		}
 		
diff --git a/server/server.php b/server/server.php
index a1dd409..135fac2 100644
--- a/server/server.php
+++ b/server/server.php
@@ -67,7 +67,7 @@
 */
 
 // Check if there is anything to update
-$tmp_rec = $app->dbmaster->queryOneRecord("SELECT count(server_id) as number from sys_datalog WHERE server_id = ".$conf["server_id"]);
+$tmp_rec = $app->dbmaster->queryOneRecord("SELECT count(server_id) as number from sys_datalog WHERE server_id = ".$conf["server_id"]." AND status = 'pending'");
 $tmp_num_records = $tmp_rec["number"];
 unset($tmp_rec);
 

--
Gitblit v1.9.1