summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Milestone.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-05-12 07:49:53 +0200
committerByron Jones <glob@mozilla.com>2014-05-12 07:49:53 +0200
commit3ff56a88eebef3699df7e524dea89be7b593337f (patch)
tree5cb921c3b7a0699e4c01594b6faabbd6b12c2535 /Bugzilla/Milestone.pm
parent02954330c3c5f4d13dc4b4c287af21edff64043f (diff)
downloadbugzilla-3ff56a88eebef3699df7e524dea89be7b593337f.tar.gz
bugzilla-3ff56a88eebef3699df7e524dea89be7b593337f.tar.xz
Bug 992767: backport bug 987032 to bmo (allow memcached to cache bugzilla configuration information)
Diffstat (limited to 'Bugzilla/Milestone.pm')
-rw-r--r--Bugzilla/Milestone.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/Bugzilla/Milestone.pm b/Bugzilla/Milestone.pm
index a5f3ed383..d8fcd79a5 100644
--- a/Bugzilla/Milestone.pm
+++ b/Bugzilla/Milestone.pm
@@ -108,10 +108,12 @@ sub run_create_validators {
sub update {
my $self = shift;
+ my $dbh = Bugzilla->dbh;
+
+ $dbh->bz_start_transaction();
my $changes = $self->SUPER::update(@_);
if (exists $changes->{value}) {
- my $dbh = Bugzilla->dbh;
# The milestone value is stored in the bugs table instead of its ID.
$dbh->do('UPDATE bugs SET target_milestone = ?
WHERE target_milestone = ? AND product_id = ?',
@@ -121,8 +123,11 @@ sub update {
$dbh->do('UPDATE products SET defaultmilestone = ?
WHERE id = ? AND defaultmilestone = ?',
undef, ($self->name, $self->product_id, $changes->{value}->[0]));
- Bugzilla->memcached->clear({ table => 'produles', id => $self->product_id });
+ Bugzilla->memcached->clear({ table => 'products', id => $self->product_id });
}
+ $dbh->bz_commit_transaction();
+ Bugzilla->memcached->clear_config();
+
return $changes;
}
@@ -130,6 +135,8 @@ sub remove_from_db {
my $self = shift;
my $dbh = Bugzilla->dbh;
+ $dbh->bz_start_transaction();
+
# The default milestone cannot be deleted.
if ($self->name eq $self->product->default_milestone) {
ThrowUserError('milestone_is_default', { milestone => $self });
@@ -158,8 +165,9 @@ sub remove_from_db {
Bugzilla->user->id, $timestamp);
}
}
+ $self->SUPER::remove_from_db();
- $dbh->do('DELETE FROM milestones WHERE id = ?', undef, $self->id);
+ $dbh->bz_commit_transaction();
}
################################