From c5464b5bb7dfece2bad2b8af9eba4d9b6d07d778 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Fri, 31 Jan 2014 15:18:51 +0800 Subject: Bug 956233: enable USE_MEMCACHE on most objects r=dkl, a=glob --- Bugzilla/Classification.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Bugzilla/Classification.pm') diff --git a/Bugzilla/Classification.pm b/Bugzilla/Classification.pm index 771a894b4..5d488e3b9 100644 --- a/Bugzilla/Classification.pm +++ b/Bugzilla/Classification.pm @@ -55,9 +55,18 @@ sub remove_from_db { ThrowUserError("classification_not_deletable") if ($self->id == 1); $dbh->bz_start_transaction(); + # Reclassify products to the default classification, if needed. - $dbh->do("UPDATE products SET classification_id = 1 - WHERE classification_id = ?", undef, $self->id); + my @product_ids = $dbh->selectrow_array( + "SELECT id FROM products WHERE classification_id = ?", + undef, $self->id); + if (@product_ids) { + $dbh->do("UPDATE products SET classification_id = 1 WHERE " . + $dbh->sql_in('id', \@product_ids)); + foreach my $id (@product_ids) { + Bugzilla->memcached->clear({ table => 'products', id => $id }); + } + } $self->SUPER::remove_from_db(); -- cgit v1.2.3-24-g4f1b