}
# lock the tables before we start to change everything:
- $dbh->bz_lock_tables('classifications WRITE', 'products WRITE');
+ $dbh->bz_start_transaction();
# delete
$dbh->do("DELETE FROM classifications WHERE id = ?", undef,
$dbh->do("UPDATE products SET classification_id = 1
WHERE classification_id = ?", undef, $classification->id);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
$vars->{'classification'} = $classification;
|| ThrowUserError('classification_invalid_sortkey', {'name' => $class_old->name,
'sortkey' => $stored_sortkey});
- $dbh->bz_lock_tables('classifications WRITE');
+ $dbh->bz_start_transaction();
if ($class_name ne $class_old->name) {
$vars->{'updated_sortkey'} = 1;
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
delete_token($token);
LoadTemplate($action);
trick_taint($comp_name);
trick_taint($description);
- $dbh->bz_lock_tables('components WRITE', 'component_cc WRITE');
+ $dbh->bz_start_transaction();
$dbh->do("INSERT INTO components
(product_id, name, description, initialowner,
$sth->execute($user_id, $component->id);
}
- $dbh->bz_unlock_tables;
+ $dbh->bz_commit_transaction();
# Insert default charting queries for this product.
# If they aren't using charting, this won't do any harm.
}
}
- $dbh->bz_lock_tables('components WRITE', 'component_cc WRITE',
- 'flaginclusions WRITE', 'flagexclusions WRITE');
+ $dbh->bz_start_transaction();
$dbh->do("DELETE FROM flaginclusions WHERE component_id = ?",
undef, $component->id);
$dbh->do("DELETE FROM components WHERE id = ?",
undef, $component->id);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
$vars->{'comp'} = $component;
$vars->{'product'} = $product;
my $initial_cc_ids = check_initial_cc(\@initial_cc);
- $dbh->bz_lock_tables('components WRITE', 'component_cc WRITE',
- 'profiles READ');
+ $dbh->bz_start_transaction();
if ($comp_name ne $component_old->name) {
$vars->{'updated_initialcc'} = 1;
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
my $component = new Bugzilla::Component($component_old->id);
my $target_type = $cgi->param('target_type') eq "bug" ? "b" : "a";
- $dbh->bz_lock_tables('flagtypes WRITE', 'products READ',
- 'components READ', 'flaginclusions WRITE',
- 'flagexclusions WRITE');
+ $dbh->bz_start_transaction();
# Insert a record for the new flag type into the database.
$dbh->do('INSERT INTO flagtypes
# Populate the list of inclusions/exclusions for this flag type.
validateAndSubmit($id);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
$vars->{'name'} = $cgi->param('name');
$vars->{'message'} = "flag_type_created";
my $dbh = Bugzilla->dbh;
my $user = Bugzilla->user;
- $dbh->bz_lock_tables('flagtypes WRITE', 'products READ',
- 'components READ', 'flaginclusions WRITE',
- 'flagexclusions WRITE');
+ $dbh->bz_start_transaction();
$dbh->do('UPDATE flagtypes
SET name = ?, description = ?, cc_list = ?,
sortkey = ?, is_active = ?, is_requestable = ?,
# Update the list of inclusions/exclusions for this flag type.
validateAndSubmit($id);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
# Clear existing flags for bugs/attachments in categories no longer on
# the list of inclusions or that have been added to the list of exclusions.
my $id = $flag_type->id;
my $dbh = Bugzilla->dbh;
- $dbh->bz_lock_tables('flagtypes WRITE', 'flags WRITE',
- 'flaginclusions WRITE', 'flagexclusions WRITE');
+ $dbh->bz_start_transaction();
# Get the name of the flag type so we can tell users
# what was deleted.
$dbh->do('DELETE FROM flaginclusions WHERE type_id = ?', undef, $id);
$dbh->do('DELETE FROM flagexclusions WHERE type_id = ?', undef, $id);
$dbh->do('DELETE FROM flagtypes WHERE id = ?', undef, $id);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
$vars->{'message'} = "flag_type_deleted";
delete_token($token);
my $dbh = Bugzilla->dbh;
- $dbh->bz_lock_tables('flagtypes WRITE');
+ $dbh->bz_start_transaction();
$dbh->do('UPDATE flagtypes SET is_active = 0 WHERE id = ?', undef, $flag_type->id);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
$vars->{'message'} = "flag_type_deactivated";
$vars->{'flag_type'} = $flag_type;
my $group = new Bugzilla::Group(CheckGroupID($cgi->param('group_id')));
my $regexp = CheckGroupRegexp($cgi->param('regexp'));
- $dbh->bz_lock_tables('groups WRITE', 'profiles READ',
- 'user_group_map WRITE');
+ $dbh->bz_start_transaction();
my $users = $group->members_direct();
my $sth_delete = $dbh->prepare(
push(@deleted, $member);
}
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
$vars->{'users'} = \@deleted;
$vars->{'regexp'} = $regexp;
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
- $dbh->bz_lock_tables('groups WRITE', 'group_group_map WRITE',
- 'bug_group_map WRITE', 'user_group_map WRITE',
- 'group_control_map READ', 'bugs READ', 'profiles READ',
- # Due to the way Bugzilla::Config::BugFields::get_param_list()
- # works, we need to lock these tables too.
- 'priority READ', 'bug_severity READ', 'rep_platform READ',
- 'op_sys READ');
+ $dbh->bz_start_transaction();
# Check that the given group ID is valid and make a Group.
my $group = new Bugzilla::Group(CheckGroupID($cgi->param('group_id')));
$data->[0], $data->[1]);
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
return $changes;
}
}
}
- $dbh->bz_lock_tables('products WRITE', 'components WRITE',
- 'versions WRITE', 'milestones WRITE',
- 'group_control_map WRITE', 'component_cc WRITE',
- 'flaginclusions WRITE', 'flagexclusions WRITE');
+ $dbh->bz_start_transaction();
my $comp_ids = $dbh->selectcol_arrayref('SELECT id FROM components
WHERE product_id = ?',
$dbh->do("DELETE FROM products WHERE id = ?",
undef, $product->id);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
delete_token($token);
{groupname => $groupname});
}
}
- $dbh->bz_lock_tables('groups READ',
- 'group_control_map WRITE',
- 'bugs WRITE',
- 'bugs_activity WRITE',
- 'bug_group_map WRITE',
- 'fielddefs READ');
+ $dbh->bz_start_transaction();
my $sth_Insert = $dbh->prepare('INSERT INTO group_control_map
(group_id, product_id, entry, membercontrol,
push(@added_mandatory, \%group);
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
delete_token($token);
{votestoconfirm => $stored_votestoconfirm});
}
- $dbh->bz_lock_tables('products WRITE', 'milestones READ');
+ $dbh->bz_start_transaction();
my $testproduct =
new Bugzilla::Product({name => $product_name});
undef, ($product_name, $product_old->id));
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
my $product = new Bugzilla::Product({name => $product_name});
$otherUserID = $otherUser->id;
# Lock tables during the check+update session.
- $dbh->bz_lock_tables('profiles WRITE',
- 'profiles_activity WRITE',
- 'fielddefs READ',
- 'tokens WRITE',
- 'logincookies WRITE',
- 'groups READ',
- 'user_group_map WRITE',
- 'group_group_map READ',
- 'group_group_map AS ggm READ',
- 'user_group_map AS directmember READ',
- 'user_group_map AS regexpmember READ',
- 'user_group_map AS directbless READ');
+ $dbh->bz_start_transaction();
$editusers || $user->can_see_user($otherUser)
|| ThrowUserError('auth_failure', {reason => "not_visible",
}
# XXX: should create profiles_activity entries for blesser changes.
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
# XXX: userDataToVars may be off when editing ourselves.
userDataToVars($otherUserID);
# XXX: if there was some change on these tables after the deletion
# confirmation checks, we may do something here we haven't warned
# about.
- $dbh->bz_lock_tables('bugs WRITE',
- 'bugs_activity WRITE',
- 'attachments READ',
- 'fielddefs READ',
- 'products READ',
- 'components READ',
- 'logincookies WRITE',
- 'profiles WRITE',
- 'profiles_activity WRITE',
- 'email_setting WRITE',
- 'profile_setting WRITE',
- 'bug_group_map READ',
- 'user_group_map WRITE',
- 'flags WRITE',
- 'flagtypes READ',
- 'cc WRITE',
- 'namedqueries WRITE',
- 'namedqueries_link_in_footer WRITE',
- 'namedquery_group_map WRITE',
- 'tokens WRITE',
- 'votes WRITE',
- 'watch WRITE',
- 'series WRITE',
- 'series_data WRITE',
- 'whine_schedules WRITE',
- 'whine_queries WRITE',
- 'whine_events WRITE');
+ $dbh->bz_start_transaction();
Bugzilla->params->{'allowuserdeletion'}
|| ThrowUserError('users_deletion_disabled');
# Finally, remove the user account itself.
$dbh->do('DELETE FROM profiles WHERE userid = ?', undef, $otherUserID);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
delete_token($token);
$vars->{'message'} = 'account_deleted';
trick_taint($value);
- my @lock_tables = ('bugs READ', "$field WRITE");
- push(@lock_tables, 'status_workflow WRITE') if ($field eq 'bug_status');
- $dbh->bz_lock_tables(@lock_tables);
+ $dbh->bz_start_transaction();
# Check if there are any bugs that still have this value.
my $bug_ids = $dbh->selectcol_arrayref(
$dbh->do("DELETE FROM $field WHERE value = ?", undef, $value);
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
delete_token($token);
$template->process("admin/fieldvalues/deleted.html.tmpl",
ThrowUserError('fieldvalue_name_too_long', $vars);
}
- $dbh->bz_lock_tables('bugs WRITE', "$field WRITE");
+ $dbh->bz_start_transaction();
# Need to store because detaint_natural() will delete this if
# invalid
$vars->{'updated_value'} = 1;
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
# If the old value was the default value for the field,
# update data/params accordingly.