From: hickert Date: Tue, 27 Nov 2007 10:30:15 +0000 (+0000) Subject: Added user to search statement. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=03f7107e017ba05c9fca5160e563f7efd286913e;p=gosa.git 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 --- 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);