Commit fba06c0a authored by bugreport%peshkin.net's avatar bugreport%peshkin.net

Bug 252450: Unlock tables in edit*.cgi before sending trailer

r=kiko a=justdave
parent 667a7abd
...@@ -162,6 +162,7 @@ sub EmitFormElements ($$$$$) ...@@ -162,6 +162,7 @@ sub EmitFormElements ($$$$$)
sub PutTrailer (@) sub PutTrailer (@)
{ {
my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_); my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_);
SendSQL("UNLOCK TABLES");
my $count = $#links; my $count = $#links;
my $num = 0; my $num = 0;
...@@ -675,7 +676,6 @@ if ($action eq 'delete') { ...@@ -675,7 +676,6 @@ if ($action eq 'delete') {
SendSQL("DELETE FROM components SendSQL("DELETE FROM components
WHERE id=$component_id"); WHERE id=$component_id");
print "Components deleted.<P>\n"; print "Components deleted.<P>\n";
SendSQL("UNLOCK TABLES");
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
PutTrailer($localtrailer); PutTrailer($localtrailer);
...@@ -782,7 +782,6 @@ if ($action eq 'update') { ...@@ -782,7 +782,6 @@ if ($action eq 'update') {
unless ($description) { unless ($description) {
print "Sorry, I can't delete the description."; print "Sorry, I can't delete the description.";
PutTrailer($localtrailer); PutTrailer($localtrailer);
SendSQL("UNLOCK TABLES");
exit; exit;
} }
SendSQL("UPDATE components SendSQL("UPDATE components
...@@ -795,7 +794,6 @@ if ($action eq 'update') { ...@@ -795,7 +794,6 @@ if ($action eq 'update') {
if ($initialowner ne $initialownerold) { if ($initialowner ne $initialownerold) {
unless ($initialowner) { unless ($initialowner) {
print "Sorry, I can't delete the initial owner."; print "Sorry, I can't delete the initial owner.";
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
} }
...@@ -803,7 +801,6 @@ if ($action eq 'update') { ...@@ -803,7 +801,6 @@ if ($action eq 'update') {
my $initialownerid = DBname_to_id($initialowner); my $initialownerid = DBname_to_id($initialowner);
unless ($initialownerid) { unless ($initialownerid) {
print "Sorry, you must use an existing Bugzilla account as initial owner."; print "Sorry, you must use an existing Bugzilla account as initial owner.";
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
} }
...@@ -818,7 +815,6 @@ if ($action eq 'update') { ...@@ -818,7 +815,6 @@ if ($action eq 'update') {
my $initialqacontactid = DBname_to_id($initialqacontact); my $initialqacontactid = DBname_to_id($initialqacontact);
if (!$initialqacontactid && $initialqacontact ne '') { if (!$initialqacontactid && $initialqacontact ne '') {
print "Sorry, you must use an existing Bugzilla account as initial QA contact."; print "Sorry, you must use an existing Bugzilla account as initial QA contact.";
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
} }
...@@ -834,13 +830,11 @@ if ($action eq 'update') { ...@@ -834,13 +830,11 @@ if ($action eq 'update') {
unless ($component) { unless ($component) {
print "Sorry, but a component must have a name."; print "Sorry, but a component must have a name.";
PutTrailer($localtrailer); PutTrailer($localtrailer);
SendSQL("UNLOCK TABLES");
exit; exit;
} }
if (TestComponent($product,$component)) { if (TestComponent($product,$component)) {
print "Sorry, component name '$component' is already in use."; print "Sorry, component name '$component' is already in use.";
PutTrailer($localtrailer); PutTrailer($localtrailer);
SendSQL("UNLOCK TABLES");
exit; exit;
} }
...@@ -850,7 +844,6 @@ if ($action eq 'update') { ...@@ -850,7 +844,6 @@ if ($action eq 'update') {
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
print "Updated component name.<BR>\n"; print "Updated component name.<BR>\n";
} }
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
......
...@@ -115,6 +115,7 @@ sub EmitFormElements ($$$) ...@@ -115,6 +115,7 @@ sub EmitFormElements ($$$)
sub PutTrailer (@) sub PutTrailer (@)
{ {
my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_); my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_);
SendSQL("UNLOCK TABLES");
my $count = $#links; my $count = $#links;
my $num = 0; my $num = 0;
...@@ -453,7 +454,6 @@ if ($action eq 'delete') { ...@@ -453,7 +454,6 @@ if ($action eq 'delete') {
WHERE product_id=$product_id WHERE product_id=$product_id
AND value=" . SqlQuote($milestone)); AND value=" . SqlQuote($milestone));
print "Milestone deleted.<P>\n"; print "Milestone deleted.<P>\n";
SendSQL("UNLOCK TABLES");
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
PutTrailer($localtrailer); PutTrailer($localtrailer);
...@@ -535,13 +535,11 @@ if ($action eq 'update') { ...@@ -535,13 +535,11 @@ if ($action eq 'update') {
unless ($milestone) { unless ($milestone) {
print "Sorry, I can't delete the milestone text."; print "Sorry, I can't delete the milestone text.";
PutTrailer($localtrailer); PutTrailer($localtrailer);
SendSQL("UNLOCK TABLES");
exit; exit;
} }
if (TestMilestone($product,$milestone)) { if (TestMilestone($product,$milestone)) {
print "Sorry, milestone '$milestone' is already in use."; print "Sorry, milestone '$milestone' is already in use.";
PutTrailer($localtrailer); PutTrailer($localtrailer);
SendSQL("UNLOCK TABLES");
exit; exit;
} }
SendSQL("UPDATE bugs SendSQL("UPDATE bugs
...@@ -560,7 +558,6 @@ if ($action eq 'update') { ...@@ -560,7 +558,6 @@ if ($action eq 'update') {
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
print "Updated milestone.<BR>\n"; print "Updated milestone.<BR>\n";
} }
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
......
...@@ -149,6 +149,7 @@ sub EmitFormElements ($$$$$$$$) ...@@ -149,6 +149,7 @@ sub EmitFormElements ($$$$$$$$)
sub PutTrailer (@) sub PutTrailer (@)
{ {
my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_); my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_);
SendSQL("UNLOCK TABLES");
my $count = $#links; my $count = $#links;
my $num = 0; my $num = 0;
...@@ -685,8 +686,6 @@ if ($action eq 'delete') { ...@@ -685,8 +686,6 @@ if ($action eq 'delete') {
WHERE id=$product_id"); WHERE id=$product_id");
print "Product '$product' deleted.<BR>\n"; print "Product '$product' deleted.<BR>\n";
SendSQL("UNLOCK TABLES");
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
...@@ -1059,7 +1058,6 @@ if ($action eq 'updategroupcontrols') { ...@@ -1059,7 +1058,6 @@ if ($action eq 'updategroupcontrols') {
} }
print "added $count bugs<p>\n"; print "added $count bugs<p>\n";
} }
SendSQL("UNLOCK TABLES");
print "Group control updates done<P>\n"; print "Group control updates done<P>\n";
PutTrailer($localtrailer); PutTrailer($localtrailer);
...@@ -1133,7 +1131,6 @@ if ($action eq 'update') { ...@@ -1133,7 +1131,6 @@ if ($action eq 'update') {
if ($description ne $descriptionold) { if ($description ne $descriptionold) {
unless ($description) { unless ($description) {
print "Sorry, I can't delete the description."; print "Sorry, I can't delete the description.";
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
} }
...@@ -1184,7 +1181,6 @@ if ($action eq 'update') { ...@@ -1184,7 +1181,6 @@ if ($action eq 'update') {
" AND product_id = $product_id"); " AND product_id = $product_id");
if (!FetchOneColumn()) { if (!FetchOneColumn()) {
print "Sorry, the milestone $defaultmilestone must be defined first."; print "Sorry, the milestone $defaultmilestone must be defined first.";
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
} }
......
...@@ -124,6 +124,7 @@ sub EmitFormElements ($$) ...@@ -124,6 +124,7 @@ sub EmitFormElements ($$)
sub PutTrailer (@) sub PutTrailer (@)
{ {
my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_); my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_);
SendSQL("UNLOCK TABLES");
my $count = $#links; my $count = $#links;
my $num = 0; my $num = 0;
...@@ -444,7 +445,6 @@ if ($action eq 'delete') { ...@@ -444,7 +445,6 @@ if ($action eq 'delete') {
WHERE product_id = $product_id WHERE product_id = $product_id
AND value=" . SqlQuote($version)); AND value=" . SqlQuote($version));
print "Version deleted.<P>\n"; print "Version deleted.<P>\n";
SendSQL("UNLOCK TABLES");
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
PutTrailer($localtrailer); PutTrailer($localtrailer);
...@@ -509,13 +509,11 @@ if ($action eq 'update') { ...@@ -509,13 +509,11 @@ if ($action eq 'update') {
unless ($version) { unless ($version) {
print "Sorry, I can't delete the version text."; print "Sorry, I can't delete the version text.";
PutTrailer($localtrailer); PutTrailer($localtrailer);
SendSQL("UNLOCK TABLES");
exit; exit;
} }
if (TestVersion($product,$version)) { if (TestVersion($product,$version)) {
print "Sorry, version '$version' is already in use."; print "Sorry, version '$version' is already in use.";
PutTrailer($localtrailer); PutTrailer($localtrailer);
SendSQL("UNLOCK TABLES");
exit; exit;
} }
SendSQL("UPDATE bugs SendSQL("UPDATE bugs
...@@ -530,7 +528,6 @@ if ($action eq 'update') { ...@@ -530,7 +528,6 @@ if ($action eq 'update') {
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
print "Updated version.<BR>\n"; print "Updated version.<BR>\n";
} }
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer); PutTrailer($localtrailer);
exit; exit;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment