diff options
author | lpsolit%gmail.com <> | 2007-11-15 04:56:31 +0000 |
---|---|---|
committer | lpsolit%gmail.com <> | 2007-11-15 04:56:31 +0000 |
commit | 0dadaed4ffb582ccfbc2356e7715007819d1cea2 (patch) | |
tree | a44cf83a9670d0a5e2ebc63a1dcc27a012924fc1 /attachment.cgi | |
parent | ec38a93e110be22f7316871994f91dc53712bcd2 (diff) | |
download | bugs-0dadaed4ffb582ccfbc2356e7715007819d1cea2.tar bugs-0dadaed4ffb582ccfbc2356e7715007819d1cea2.tar.gz bugs-0dadaed4ffb582ccfbc2356e7715007819d1cea2.tar.bz2 bugs-0dadaed4ffb582ccfbc2356e7715007819d1cea2.tar.xz bugs-0dadaed4ffb582ccfbc2356e7715007819d1cea2.zip |
Bug 403824: Replace table locks in most Bugzilla files with transactions - Patch by Emmanuel Seyman <eseyman@linagora.com> r/a=mkanat
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-x | attachment.cgi | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/attachment.cgi b/attachment.cgi index 2d5b6abc4..23841571c 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -479,18 +479,8 @@ sub update { }); Bugzilla::Flag::validate($cgi, $bug->id, $attachment->id); - # Lock database tables in preparation for updating the attachment. - $dbh->bz_lock_tables('attachments WRITE', 'flags WRITE' , - 'flagtypes READ', 'fielddefs READ', 'bugs_activity WRITE', - 'flaginclusions AS i READ', 'flagexclusions AS e READ', - # cc, bug_group_map, user_group_map, and groups are in here so we - # can check the permissions of flag requestees and email addresses - # on the flag type cc: lists via the CanSeeBug - # function call in Flag::notify. group_group_map is in here si - # Bugzilla::User can flatten groups. - 'bugs WRITE', 'profiles READ', 'email_setting READ', - 'cc READ', 'bug_group_map READ', 'user_group_map READ', - 'group_group_map READ', 'groups READ', 'group_control_map READ'); + # Start a transaction in preparation for updating the attachment. + $dbh->bz_start_transaction(); # Quote the description and content type for use in the SQL UPDATE statement. my $description = $cgi->param('description'); @@ -560,8 +550,8 @@ sub update { $attachment->isprivate, $updated_attachment->isprivate); } - # Unlock all database tables now that we are finished updating the database. - $dbh->bz_unlock_tables(); + # Commit the transaction now that we are finished updating the database. + $dbh->bz_commit_transaction(); # If the user submitted a comment while editing the attachment, # add the comment to the bug. @@ -634,14 +624,14 @@ sub delete_attachment { $template->process("attachment/delete_reason.txt.tmpl", $vars, \$msg) || ThrowTemplateError($template->error()); - $dbh->bz_lock_tables('attachments WRITE', 'attach_data WRITE', 'flags WRITE'); + $dbh->bz_start_transaction(); $dbh->do('DELETE FROM attach_data WHERE id = ?', undef, $attachment->id); $dbh->do('UPDATE attachments SET mimetype = ?, ispatch = ?, isurl = ?, isobsolete = ? WHERE attach_id = ?', undef, ('text/plain', 0, 0, 1, $attachment->id)); $dbh->do('DELETE FROM flags WHERE attach_id = ?', undef, $attachment->id); - $dbh->bz_unlock_tables; + $dbh->bz_commit_transaction(); # If the attachment is stored locally, remove it. if (-e $attachment->_get_local_filename) { |