]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 508729: Cache Bugzilla::Status::BUG_STATE_OPEN
authormkanat%bugzilla.org <>
Thu, 6 Aug 2009 14:59:37 +0000 (14:59 +0000)
committermkanat%bugzilla.org <>
Thu, 6 Aug 2009 14:59:37 +0000 (14:59 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit

Bugzilla/Status.pm

index 289e1726056add8f4533b98e1ab516dd795b9e31..4720dc1293031f781e714fe813b9d41ae9162975 100644 (file)
@@ -66,6 +66,7 @@ sub VALIDATORS {
 sub create {
     my $class = shift;
     my $self = $class->SUPER::create(@_);
+    delete Bugzilla->request_cache->{status_bug_state_open};
     add_missing_bug_status_transitions();
     return $self;
 }
@@ -80,6 +81,7 @@ sub remove_from_db {
                WHERE old_status = ? OR new_status = ?',
               undef, $id, $id);
     $dbh->bz_commit_transaction();
+    delete Bugzilla->request_cache->{status_bug_state_open};
 }
 
 ###############################
@@ -120,9 +122,12 @@ sub _check_value {
 ###############################
 
 sub BUG_STATE_OPEN {
-    # XXX - We should cache this list.
     my $dbh = Bugzilla->dbh;
-    return @{$dbh->selectcol_arrayref('SELECT value FROM bug_status WHERE is_open = 1')};
+    my $cache = Bugzilla->request_cache;
+    $cache->{status_bug_state_open} ||=
+        $dbh->selectcol_arrayref('SELECT value FROM bug_status 
+                                   WHERE is_open = 1');
+    return @{ $cache->{status_bug_state_open} };
 }
 
 # Tells you whether or not the argument is a valid "open" state.