From 61a2c49b896be4473505e07f450a78aaef038a22 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 4 Oct 2005 03:13:58 +0000 Subject: [PATCH] r489: Cleaning up the logging system to work a little better --- attachment.php | 5 ----- docs/schema_changes.sql | 6 +++++- editcomment.php | 1 - editreport.php | 6 +----- includes/class_history.php | 12 +++--------- newcomment.php | 1 - showhistory.php | 6 ------ templates/history_group.tpl | 2 -- 8 files changed, 9 insertions(+), 30 deletions(-) diff --git a/attachment.php b/attachment.php index a2547b8..c83e7b8 100755 --- a/attachment.php +++ b/attachment.php @@ -52,7 +52,6 @@ if ($_REQUEST['do'] == 'kill') $db->query("DELETE FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = $attachment[attachmentid]"); - $log->language = 'log_kill_attachment'; $log->arguments = array($attachment['attachmentid']); $log->allowempty = true; $log->log(); @@ -125,7 +124,6 @@ if ($_POST['do'] == 'insert') ); $attachmentid = $db->insert_id(); - $log->language = 'log_new_attachment'; $log->arguments = array($FILE['name'], $attachmentid); $log->allowempty = true; $log->log(); @@ -137,7 +135,6 @@ if ($_POST['do'] == 'insert') array_walk($obsoletes, 'intval'); $db->query("UPDATE " . TABLE_PREFIX . "attachment SET obsolete = 1 WHERE attachmentid IN (" . implode(',', $obsoletes) . ") AND !obsolete AND bugid = $bug[bugid]"); - $log->language = 'log_mark_obsoletes'; $log->arguments = array($attachmentid, $FILE['name'], implode(', ', $obsoletes)); $log->log($log->diff($lang->string('Obsoleted attachments'), '', implode(', ', $obsoletes))); } @@ -164,7 +161,6 @@ if ($_POST['do'] == 'insert') $commentid = $db->insert_id(); - $log->language = 'log_new_attachment_comment'; $log->arguments = array($attachmentid, $commentid); $log->allowempty = true; $log->log(); @@ -222,7 +218,6 @@ if ($_POST['do'] == 'update') $diff[0] = array_diff_assoc($attachment, $hist[1]); $diff[1] = array_diff_assoc($hist[1], $attachment); - $log->language = 'log_update_attachment'; $log->arguments = array($attachment['attachmentid']); $log->log($log->diff('description', $diff[0]['description'], $diff[1]['description'])); $log->log($log->diff('obsolete', $diff[0]['obsolete'], $diff[1]['obsolete'])); diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index cff9e92..387f27d 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -48,4 +48,8 @@ ALTER TABLE `localization` ADD `localid` INT(10) UNSIGNED NOT NULL AUTO_INCREMEN ALTER TABLE `localization` CHANGE `phrasetext` `localtext` MEDIUMTEXT NOT NULL; -ALTER TABLE `language` ADD `filename` VARCHAR(255) NOT NULL AFTER `direction`; \ No newline at end of file +ALTER TABLE `language` ADD `filename` VARCHAR(255) NOT NULL AFTER `direction`; + +ALTER TABLE `history` DROP `language`; + +ALTER TABLE `history` DROP `arguments`; \ No newline at end of file diff --git a/editcomment.php b/editcomment.php index eabaa23..18a5173 100644 --- a/editcomment.php +++ b/editcomment.php @@ -80,7 +80,6 @@ if ($_POST['do'] == 'update') require_once('./includes/class_history.php'); $log = new History(); $log->bugid = $bug['bugid']; - $log->language = 'log_update_comment'; $log->arguments = array($comment['commentid']); $log->log(); $log->log($log->diff('hidden', $comment['hidden'], intval($bugsys->in['hidden']))); diff --git a/editreport.php b/editreport.php index c724241..8c9dc6c 100644 --- a/editreport.php +++ b/editreport.php @@ -99,7 +99,6 @@ if ($_POST['do'] == 'update') if ($hascomment) { - $log->language = 'log_new_comment'; $log->arguments = array($commentid); $log->log(); } @@ -190,9 +189,7 @@ if ($_POST['do'] == 'update') 'productid' => 'product', 'componentid' => 'product' ); - - $log->language = 'log_update_bug'; - + foreach ($diff AS $num => $diffs) { foreach ($diffs AS $key => $value) @@ -308,7 +305,6 @@ if ($_POST['do'] == 'update') if ($hascomment) { - $log->language = 'log_new_comment'; $log->arguments = array($commentid); $log->log(); } diff --git a/includes/class_history.php b/includes/class_history.php index 0fa82e3..6b13c4e 100644 --- a/includes/class_history.php +++ b/includes/class_history.php @@ -13,8 +13,6 @@ class History { var $bugid = 0; - var $language = ''; - var $arguments = array(); var $allowempty = false; // ------------------------------------------------------------------- @@ -25,8 +23,6 @@ class History global $bugsys; $this->bugid = intval($this->bugid); - $this->language = $bugsys->escape($this->language); - $arguments = $bugsys->escape(serialize($this->arguments)); if ($diffdata == -1) { @@ -37,10 +33,9 @@ class History { $bugsys->db->query(" INSERT INTO " . TABLE_PREFIX . "history - (bugid, dateline, userid, language, arguments) + (bugid, dateline, userid) VALUES - (" . $this->bugid . ", " . LOG_TIME . ", " . $bugsys->userinfo['userid'] . ", - '" . $this->language . "', '" . $arguments . "' + (" . $this->bugid . ", " . LOG_TIME . ", " . $bugsys->userinfo['userid'] . " )" ); } @@ -48,10 +43,9 @@ class History { $bugsys->db->query(" INSERT INTO " . TABLE_PREFIX . "history - (bugid, dateline, userid, language, arguments, field, original, changed) + (bugid, dateline, userid, field, original, changed) VALUES (" . $this->bugid . ", " . LOG_TIME . ", " . $bugsys->userinfo['userid'] . ", - '" . $this->language . "', '" . $arguments . "', '" . $bugsys->escape($diffdata['field']) . "', '" . $bugsys->escape($diffdata['initial']) . "', '" . $bugsys->escape($diffdata['final']) . "' )" diff --git a/newcomment.php b/newcomment.php index 4bfa9d8..7ef172f 100644 --- a/newcomment.php +++ b/newcomment.php @@ -57,7 +57,6 @@ if ($_POST['do'] == 'insert') require_once('./includes/class_history.php'); $log = new History(); $log->bugid = $bugsys->in['bugid']; - $log->language = 'log_new_comment'; $log->arguments = array($commentid); $log->log(); diff --git a/showhistory.php b/showhistory.php index def3a03..495249b 100644 --- a/showhistory.php +++ b/showhistory.php @@ -60,7 +60,6 @@ $logs_fetch = $db->query(" ); while ($log = $db->fetch_array($logs_fetch)) { - $log['formatted'] = call_user_func_array(array(lang, 'p'), array_merge(array($log['language']), unserialize($log['arguments']))); $log['date'] = $datef->format($bugsys->options['dateformat'], $log['dateline']); $log['user'] = construct_user_display($log); @@ -92,11 +91,6 @@ foreach ($logs AS $dateline => $logitems) $rowspan++; eval('$changes .= "' . $template->fetch('history_bit') . '";'); } - - if (!in_array($log['formatted'], $messages)) - { - $messages[] = $log['formatted']; - } } $log['messages'] = implode("
\n", $messages); diff --git a/templates/history_group.tpl b/templates/history_group.tpl index ad62ef5..7e889d1 100644 --- a/templates/history_group.tpl +++ b/templates/history_group.tpl @@ -4,8 +4,6 @@ $log[user]
- $log[messages] - -- 2.22.5