From 03f7107e017ba05c9fca5160e563f7efd286913e Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 27 Nov 2007 10:30:15 +0000 Subject: [PATCH] Added user to search statement. rearranged SQL statement. Should be much faster now. - Slow string operations were done, before fast integer operations. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7904 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/addons/logview/class_gosa_logview.inc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/addons/logview/class_gosa_logview.inc b/plugins/addons/logview/class_gosa_logview.inc index a3cb6ede6..a48d5ffe3 100644 --- a/plugins/addons/logview/class_gosa_logview.inc +++ b/plugins/addons/logview/class_gosa_logview.inc @@ -210,6 +210,9 @@ class gosa_logview extends plugin $start = $date_select_[$this->time]; + + $sql_regex =trim(preg_replace("/\*/","%",$this->regex)); + $sql_regex = "%".trim($sql_regex,"%")."%"; /* Order setting */ if ($this->sort_direction == "down"){ @@ -222,8 +225,10 @@ class gosa_logview extends plugin $end= date ("YmdHis",time()); $query_base= " FROM gosa_log - WHERE - result like '".preg_replace("/\*/","%",$this->regex)."' "; + WHERE + timestamp <= $end AND timestamp >= $start + AND + result like '".$sql_regex."' OR user like '".$sql_regex."' "; if($this->action != "!ALL"){ @@ -233,10 +238,6 @@ class gosa_logview extends plugin "; } - $query_base .=" - AND - timestamp <= $end AND timestamp >= $start"; - /* Get number of entries */ $query= "SELECT COUNT(*)".$query_base.";"; $result = mysql_query($query); -- 2.30.2