From 6c926fc14f987a047f1db3a793556f98f271b9f2 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" <> Date: Wed, 26 May 1999 02:22:30 +0000 Subject: Avoid mid-air collisions (implementing a suggestion by py8ieh=bugzilla@bath.ac.uk). --- process_bug.cgi | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index c671a90c2..3c1852d1d 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -260,12 +260,15 @@ if ($::comma eq "") { } my $basequery = $::query; +my $delta_ts; sub SnapShotBug { my ($id) = (@_); - SendSQL("select " . join(',', @::log_columns) . + SendSQL("select delta_ts, " . join(',', @::log_columns) . " from bugs where bug_id = $id"); - return FetchSQLData(); + my @row = FetchSQLData(); + $delta_ts = shift @row; + return @row; } @@ -273,6 +276,42 @@ foreach my $id (@idlist) { SendSQL("lock tables bugs write, bugs_activity write, cc write, profiles write"); my @oldvalues = SnapShotBug($id); + if (defined $::FORM{'delta_ts'} && $::FORM{'delta_ts'} ne $delta_ts) { + print " +

Mid-air collision detected!

+Someone else has made changes to this bug at the same time you were trying to. +The changes made were: +

+"; + DumpBugActivity($id, $delta_ts); + my $longdesc = GetLongDescription($id); + my $longchanged = 0; + if (length($longdesc) > $::FORM{'longdesclength'}) { + $longchanged = 1; + print "

Added text to the long description:

";
+            print html_quote(substr($longdesc, $::FORM{'longdesclength'}));
+            print "
\n"; + } + SendSQL("unlock tables"); + print "You have the following choices: \n}; + navigation_header(); + exit; + } + + + my $query = "$basequery\nwhere bug_id = $id"; # print "
$query
\n"; -- cgit v1.2.3-24-g4f1b