diff options
author | lpsolit%gmail.com <> | 2007-11-30 02:49:12 +0100 |
---|---|---|
committer | lpsolit%gmail.com <> | 2007-11-30 02:49:12 +0100 |
commit | f394b2ed4f175bf6076747ba7792e182841091ab (patch) | |
tree | d4ca1fcead500fd8edb40179e468423684fb7332 /Bugzilla/Attachment.pm | |
parent | 5c9cb1c442e10faad5d5234f9c90f2a4529297be (diff) | |
download | bugzilla-f394b2ed4f175bf6076747ba7792e182841091ab.tar.gz bugzilla-f394b2ed4f175bf6076747ba7792e182841091ab.tar.xz |
Bug 99215: Attachments have no midair collision protection - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat r=justdave a=justdave
Diffstat (limited to 'Bugzilla/Attachment.pm')
-rw-r--r-- | Bugzilla/Attachment.pm | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index cc3e16893..e3fe39f3a 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -91,6 +91,7 @@ sub _retrieve { 'attachments.submitter_id AS _attacher_id', Bugzilla->dbh->sql_date_format('attachments.creation_ts', '%Y.%m.%d %H:%i') . " AS attached", + 'attachments.modification_time', 'attachments.filename AS filename', 'attachments.ispatch AS ispatch', 'attachments.isurl AS isurl', @@ -208,6 +209,21 @@ sub attached { =over +=item C<modification_time> + +the date and time on which the attachment was last modified. + +=back + +=cut + +sub modification_time { + my $self = shift; + return $self->{modification_time}; +} + +=over + =item C<filename> the name of the file the attacher attached @@ -826,10 +842,10 @@ sub insert_attachment_for_bug { # Insert the attachment into the database. my $sth = $dbh->do( "INSERT INTO attachments - (bug_id, creation_ts, filename, description, + (bug_id, creation_ts, modification_time, filename, description, mimetype, ispatch, isurl, isprivate, submitter_id) - VALUES (?,?,?,?,?,?,?,?,?)", undef, ($bug->bug_id, $timestamp, $filename, - $description, $contenttype, $cgi->param('ispatch'), + VALUES (?,?,?,?,?,?,?,?,?,?)", undef, ($bug->bug_id, $timestamp, $timestamp, + $filename, $description, $contenttype, $cgi->param('ispatch'), $isurl, $isprivate, $user->id)); # Retrieve the ID of the newly created attachment record. my $attachid = $dbh->bz_last_key('attachments', 'attach_id'); @@ -877,8 +893,9 @@ sub insert_attachment_for_bug { # This call must be done before updating the 'attachments' table. Bugzilla::Flag::CancelRequests($bug, $obsolete_attachment, $timestamp); - $dbh->do('UPDATE attachments SET isobsolete = 1 WHERE attach_id = ?', - undef, $obsolete_attachment->id); + $dbh->do('UPDATE attachments SET isobsolete = 1, modification_time = ? + WHERE attach_id = ?', + undef, ($timestamp, $obsolete_attachment->id)); $dbh->do('INSERT INTO bugs_activity (bug_id, attach_id, who, bug_when, fieldid, removed, added) |