r514: - Now three different ID's that can be logged (bug, comment, attachment)
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 9 Oct 2005 17:12:04 +0000 (17:12 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 9 Oct 2005 17:12:04 +0000 (17:12 +0000)
- No longer use LOG_TIME, but TIMENOW

attachment.php
docs/schema_changes.sql
editcomment.php
editreport.php
includes/class_history.php
includes/init.php

index 46ec74497ace15793f83f48c03e1fe30e302ef50..4689b8fdf1cade454ab31c75bd722442d9f7156c 100755 (executable)
@@ -100,8 +100,11 @@ 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->arguments = array($attachmentid, $FILE['name'], implode(', ', $obsoletes));
-               $log->log($log->diff($lang->string('Obsoleted attachments'), '', implode(', ', $obsoletes)));
+               foreach ($obsoletes AS $attachmentid)
+               {
+                       $log->attachmentid = $attachmentid;
+                       $log->log($log->diff('obsolete', 0, 1));
+               }
        }
        
        // handle comment stuff
@@ -177,7 +180,7 @@ if ($_POST['do'] == 'update')
        $diff[0] = array_diff_assoc($attachment, $hist[1]);
        $diff[1] = array_diff_assoc($hist[1], $attachment);
        
-       $log->arguments = array($attachment['attachmentid']);
+       $log->attachmentid = $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 714b06eb93202016832966cde1d096ca742df128..0211ede7f6fe8ed6965555aae2d6167728bd15ad 100644 (file)
@@ -54,4 +54,8 @@ ALTER TABLE `history` DROP `language`;
 
 ALTER TABLE `history` DROP `arguments`;
 
-ALTER TABLE `user` ADD `showcolours` INT(2) UNSIGNED NOT NULL AFTER `showemail`;
\ No newline at end of file
+ALTER TABLE `user` ADD `showcolours` INT(2) UNSIGNED NOT NULL AFTER `showemail`;
+
+ALTER TABLE `history` ADD `attachmentid` INT(10) UNSIGNED NOT NULL AFTER `bugid`;
+
+ALTER TABLE `history` ADD `commentid` INT(10) UNSIGNED NOT NULL AFTER `attachmentid`;
\ No newline at end of file
index 18a51738f58edd000915ec1245f902b671994d72..20b056cd156dfa29a5a8d9808fc83c40e6270b18 100644 (file)
@@ -80,8 +80,8 @@ if ($_POST['do'] == 'update')
        require_once('./includes/class_history.php');
        $log = new History();
        $log->bugid = $bug['bugid'];
-       $log->arguments = array($comment['commentid']);
-       $log->log();
+       $log->commentid = $comment['commentid'];
+       $log->log($log->diff('text', $comment['comment_parsed'], $bugsys->in['comment_parsed']));
        $log->log($log->diff('hidden', $comment['hidden'], intval($bugsys->in['hidden'])));
        
        $lastgood = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] AND !hidden ORDER BY dateline DESC");
index 0e12da382b6f6552cd77d5a973010169110638d2..a88775ca56813edea78db6dccdf2c944e9aaf129 100644 (file)
@@ -302,12 +302,6 @@ if ($_POST['do'] == 'update')
                                hiddenlastpostby = " . $bugsys->userinfo['userid'] . "
                        WHERE bugid = " . intval($bugsys->in['bugid'])
                );
-               
-               if ($hascomment)
-               {
-                       $log->arguments = array($commentid);
-                       $log->log();
-               }
        }
 
        
index 91629bbf6c5dc72674a73c3f10205281e26e1252..83554087a5a5342dc8a86e655749180486b68d08 100644 (file)
@@ -13,7 +13,9 @@
 class History
 {
        var $bugid = 0;
-       var $fieldid = 0;
+       var $attachmentid = 0;
+       var $commentid = 0;
+       var $allowempty = false;
        
        // -------------------------------------------------------------------
        // -- Create a log entry
@@ -23,7 +25,8 @@ class History
                global $bugsys;
                
                $this->bugid = intval($this->bugid);
-               $this->fieldid = intval($this->fieldid);
+               $this->attachmentid = intval($this->attachmentid);
+               $this->commentid = intval($this->commentid);
                
                if ($diffdata == -1)
                {
@@ -37,10 +40,10 @@ class History
 
                $bugsys->db->query("
                        INSERT INTO " . TABLE_PREFIX . "history
-                               (bugid, dateline, userid, field, fieldid, original, changed)
+                               (bugid, attachmentid, commentid, dateline, userid, field, original, changed)
                        VALUES
-                               (" . $this->bugid . ", " . LOG_TIME . ", " . $bugsys->userinfo['userid'] . ", 
-                               '" . $bugsys->escape($diffdata['field']) . "', " . $this->fieldid . ",
+                               (" . $this->bugid . ", " . $this->attachmentid . ", " . $this->commentid . ", " . TIMENOW . ",
+                               " . $bugsys->userinfo['userid'] . ", '" . $bugsys->escape($diffdata['field']) . "', 
                                '" . $bugsys->escape($diffdata['initial']) . "', '" . $bugsys->escape($diffdata['final']) . "'
                        )"
                );
index 3d834de23ac4946f6426ee27ba331e906bc2246d..194f31c6f28aa4789b8f06face4ce87f9675c905 100755 (executable)
@@ -54,8 +54,6 @@ define('COOKIE_PREFIX', $cookieprefix);
 
 unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix);
 
-define('LOG_TIME', time());
-
 require_once('./includes/functions_datastore.php');
 require_once('./includes/functions.php');