[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] admin/inc/class.solog.inc.php, 1.7
From: |
nomail |
Subject: |
[Phpgroupware-cvs] admin/inc/class.solog.inc.php, 1.7 |
Date: |
Thu, 30 Dec 2004 08:38:14 +0100 |
Update of /admin/inc
Modified Files:
Branch:
class.solog.inc.php
date: 2004/12/30 07:38:14; author: skwashd; state: Exp; lines: +41 -140
Log Message:
new HEAD admin - sans GIFs
=====================================================================
Index: admin/inc/class.solog.inc.php
diff -u admin/inc/class.solog.inc.php:1.6 admin/inc/class.solog.inc.php:1.7
--- admin/inc/class.solog.inc.php:1.6 Fri Feb 15 01:51:32 2002
+++ admin/inc/class.solog.inc.php Thu Dec 30 07:38:14 2004
@@ -1,10 +1,7 @@
<?php
/**************************************************************************\
- * phpGroupWare - solog
*
+ * phpGroupWare - Administration
*
* http://www.phpgroupware.org
*
- * This application written by Jerry Westrick <address@hidden> *
- * --------------------------------------------
*
- * Funding for this program was provided by http://www.checkwithmom.com
*
* --------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by
the *
@@ -17,162 +14,66 @@
class solog
{
var $db;
- var $owner;
- var $error_cols = '';
- var $error_cols_e = '';
- var $public_functions = array(
- 'get_error_cols' => True,
- 'get_error_cols_e' => True,
- 'get_error' => True,
- 'get_error_e' => True
- );
function solog()
{
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db = $GLOBALS['phpgw']->db;
}
- function get_error_cols()
+ function test_account_id($account_id)
{
- if ($this->error_cols == '')
+ if ($account_id)
{
- $this->error_cols = array();
-
- /* fields from phpgw_log table */
- $clist = $this->db->metadata('phpgw_log');
- for ($i=0; $i<count($clist); $i++)
- {
- $name = $clist[$i]['name'];
- $this->error_cols[$name] = array();
- }
-
- /* fields from phpgw_log_msg table */
- $clist = $this->db->metadata('phpgw_log_msg');
- for ($i=0; $i<count($clist); $i++)
- {
- $name = $clist[$i]['name'];
- $this->error_cols[$name] = array();
- }
+ return " where log_account_id='$account_id'";
}
- return $this->error_cols;
}
- function get_error_cols_e()
+ function list_log($account_id,$start,$order,$sort)
{
- if ($this->task_cols_e == '')
- {
- /* Get Columns for Errors */
- $this->error_cols_e = $this->get_error_cols();
-
- /* Enhance with Columns for phpgw_accounts */
- $clist = $this->db->metadata('phpgw_accounts');
- for ($i=0; $i<count($clist); $i++)
- {
- $name = $clist[$i]['name'];
- $this->error_cols_e[$name] = array();
- }
- }
- return $this->error_cols_e;
- }
-
- function get_error_e($parms)
- {
- /* Fixed From */
- if (!isset($parms['from']))
- {
- $parms['from'] = array('phpgw_accounts');
- }
- else
- {
- $parms['from'][] = 'phpgw_accounts';
- }
+ $where = $this->test_account_id($account_id);
- /* Fix Where */
- if (!isset($parms['where']))
+ $this->db->limit_query("select
log_date,log_account_lid,log_app,log_severity,log_file,log_line,log_msg from
phpgw_log $where order by log_id desc",$start,__LINE__,__FILE__);
+ while ($this->db->next_record())
{
- $parms['where'] = array('phpgw_log.log_user =
phpgw_accounts.account_id');
+ $records[] = array(
+ 'log_date' =>
$this->db->f('log_date'),
+ 'log_account_lid' =>
$this->db->f('log_account_lid'),
+ 'log_app' =>
$this->db->f('log_app'),
+ 'log_severity' =>
$this->db->f('log_severity'),
+ 'log_file' =>
$this->db->f('log_file'),
+ 'log_line' =>
$this->db->f('log_line'),
+ 'log_msg' =>
$this->db->f('log_msg')
+ );
}
- else
- {
- $parms['where'][] = 'phpgw_log.log_id =
phpgw_accounts.account_id';
- }
-
- /* Fix Default Fields */
- if (!isset($parms['fields']))
- {
- $parms['fields'] = $this->get_error_cols_e();
- }
-
- return $this->get_error($parms);
+ return $records;
}
- function get_no_errors()
+ function total($account_id)
{
- /* Get max ErrorId */
- $this->db->query("select count(*) as max_id from
phpgw_log, phpgw_log_msg WHERE phpgw_log.log_id =
phpgw_log_msg.log_msg_log_id",__LINE__,__FILE__);
+ $where = $this->test_account_id($account_id);
+
+ $this->db->query("select count(*) from phpgw_log
$where");
$this->db->next_record();
- return $this->db->f('max_id');
- }
- function get_error($parms)
+ return $this->db->f(0);
+ }
+
+ function purge_log($account_id)
{
- /* Get parameter values */
- $from = $parms['from'];
- $where = $parms['where'];
- $orderby = $parms['orderby'];
- $fields = $parms['fields'];
-
- /* Build From_Clause */
- $from_clause = 'FROM phpgw_log, phpgw_log_msg ';
- if (isset($from))
- {
- $from[] = 'phpgw_log';
- $from[] = 'phpgw_log_msg';
- $from_clause = 'FROM '.implode(', ' , $from).'
';
- }
-
- /* Build Where_Clause */
- $where_clause = 'WHERE phpgw_log.log_id =
phpgw_log_msg.log_msg_log_id ';
- if (isset($where))
- {
- $where[] = 'phpgw_log.log_id =
phpgw_log_msg.log_msg_log_id';
- $where_clause = 'WHERE ' . implode(' AND
',$where) . ' ';
- }
+ $where = $this->test_account_id($account_id);
- /* Build Order_By_Clause */
- $orderby_clause = 'ORDER BY phpgw_log.log_id,
phpgw_log_msg.log_msg_seq_no ';
- if (isset($orderby))
- {
- $orderby_clause = 'ORDER BY ' . implode(',
',$orderby);
- }
-
- /* If no Fields specified default to * */
- if (!isset($fields))
- {
- $fields = $this->get_error_cols();
+ $db = $GLOBALS['phpgw']->db;
+ $db->query("delete from phpgw_log
$where",__LINE__,__FILE__);
+ if ( $db->Errno ) {
+ log_error(array('text' => 'Failed to delete log
records from database using where clause of %1. DB errno %2: message %3',
+ 'p1' => $where,
+ 'p2' =>
$db->Errno,
+ 'p3' =>
$db->Error,
+ 'file' =>
__FILE__,
+ 'line' =>
__LINE__));
+ return false;
}
-
- $rows = array();
-
- /* Do Select */
- @reset($fields);
- while(list($key,$val) = @each($fields))
- {
- $fkeys .= $key . ',';
- }
- $fkeys = substr($fkeys,0,-1);
-
- $select = 'SELECT ' . $fkeys . ' ' . $from_clause .
$where_clause . $orderby_clause;
- $this->db->query($select,__LINE__,__FILE__);
- while($this->db->next_record())
- {
- reset($fields);
- while(list($fname,$fopt) = each($fields))
- {
- $this_row[$fname]['value'] =
$this->db->f($fname);
- }
- $rows[] = $this_row;
- }
- return $rows;
+ return true;
}
+
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] admin/inc/class.solog.inc.php, 1.7,
nomail <=