This commit is contained in:
Ralf Becker 2006-06-14 23:43:53 +00:00
parent 68202a23ff
commit 8aa7063c94

View File

@ -103,45 +103,32 @@
function commit() function commit()
{ {
$db = clone($GLOBALS['egw']->db); $db = clone($GLOBALS['egw']->db);
// $db->lock($this->log_table);
$db->query("insert into $this->log_table (log_date, log_user, log_app, log_severity) values " $db->insert($this->log_table,array(
."('". $GLOBALS['egw']->db->to_timestamp(time()) 'log_date' => $GLOBALS['egw']->db->to_timestamp(time()),
."','".(int)$GLOBALS['egw']->session->account_id 'log_user' => $GLOBALS['egw_info']['user']['account_id'],
."','".$GLOBALS['egw_info']['flags']['currentapp']."'" 'log_app' => $GLOBALS['egw_info']['flags']['currentapp'],
.",'".$this->severity()."'" 'log_severity' => $this->severity(),
.")" ),false,__LINE__,__FILE__);
,__LINE__,__FILE__
);
$log_id = $db->get_last_insert_id($this->log_table,'log_id'); $log_id = $db->get_last_insert_id($this->log_table,'log_id');
// $db->query('select max(log_id) as lid from $this->log_table');
// $db->next_record();
// $log_id = $db->f('lid');
// $db->unlock();
$errorstack = $this->errorstack; foreach($this->errorstack as $i => $err)
for ($i = 0; $i < count($errorstack); $i++)
{ {
$err = $errorstack[$i]; $db->insert($this->msg_table,array(
$db->query("insert into $this->msg_table " 'log_msg_log_id' => $log_id,
."(Log_msg_log_id, log_msg_seq_no, log_msg_date, log_msg_severity, " 'log_msg_seq_no' => $i,
."log_msg_code, log_msg_msg, log_msg_parms, log_msg_file, log_msg_line) values " 'log_msg_date' => $GLOBALS['egw']->db->to_timestamp($err->timestamp),
."(" . $log_id 'log_msg_severity' => $err->severity,
."," . $i 'log_msg_code' => $err->code,
.", '" . $GLOBALS['egw']->db->to_timestamp($err->timestamp) 'log_msg_msg' => $err->msg,
."', '". $err->severity . "'" 'log_msg_parms' => implode('|',(array)$err->parms),
.", '". $err->code . "'" 'log_msg_file' => $err->fname,
.", '". $db->db_addslashes($err->msg) . "'" 'log_msg_line' => $err->line,
.", '". $db->db_addslashes((count($err->parms) > 1?implode('|',$err->parms):$err->parms[1])). "'" ),false,__LINE__,__FILE__);
.", '". $err->fname . "'"
.", " . (int)$err->line
.")"
,__LINE__,__FILE__
);
} }
unset ($errorstack);
unset ($this->errorstack);
$this->errorstack = array(); $this->errorstack = array();
return true; return true;
} }