r489: Cleaning up the logging system to work a little better
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 4 Oct 2005 03:13:58 +0000 (03:13 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 4 Oct 2005 03:13:58 +0000 (03:13 +0000)
attachment.php
docs/schema_changes.sql
editcomment.php
editreport.php
includes/class_history.php
newcomment.php
showhistory.php
templates/history_group.tpl

index a2547b804b7c27f8c4a18f9dfcc1b6f87c8e3549..c83e7b8cbbe7786eff9f306a5da24a234e76908b 100755 (executable)
@@ -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']));
index cff9e9248a6466d66b56d0690ede199bd434e3fa..387f27d752b79d9270435b138ec303452c729cab 100644 (file)
@@ -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
index eabaa23299004070e8a68af38fe7f64a8dc119f3..18a51738f58edd000915ec1245f902b671994d72 100644 (file)
@@ -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'])));
index c724241a79ba901abb3a0f28351c996ed9bbc93f..8c9dc6c5ece2e9f74dda01495b2f8c07b1c14f99 100644 (file)
@@ -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();
                }
index 0fa82e3a5e0e37a713c7f15673275b014490d8df..6b13c4e9dad4555eb28482f873d00c70a7ac004d 100644 (file)
@@ -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']) . "'
                                )"
index 4bfa9d859583830228b5aae1ca72429720594cf1..7ef172f2be8920c6fe8ef414d79642d3e146c57b 100644 (file)
@@ -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();
 
index def3a0351563bf304d74c4310922fd3c224557ec..495249b3b02e3bf80b90d4591b37b26bd9271f18 100644 (file)
@@ -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("<br />\n", $messages);
index ad62ef5056202a11f9b8150d5e38d03d30131014..7e889d1c4cbddf2f7a53414629a9ec97d4215fa5 100644 (file)
@@ -4,8 +4,6 @@
                $log[user]
        </div>
        <div class="tmiddle" style="padding: $stylevar[padding]px">
-               $log[messages]
-
                <if condition="$show['changes']">
                <table cellspacing="$stylevar[spacing]" cellpadding="$stylevar[padding]px" border="$stylevar[border]" width="100%" style="margin-top: 5px">
                <thead>