]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 525420: Cache Bugzilla::Bug::VALIDATORS so that the same hash is returned every...
authormkanat%bugzilla.org <>
Mon, 14 Dec 2009 23:08:55 +0000 (23:08 +0000)
committermkanat%bugzilla.org <>
Mon, 14 Dec 2009 23:08:55 +0000 (23:08 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, r=dkl, a=mkanat

Bugzilla/Bug.pm

index 9768dede4295fa7a25e46b891c60804bd1369810..ab035fcba6d983df4d059bc0d5d04bc25ea2d602 100644 (file)
@@ -122,6 +122,9 @@ use constant REQUIRED_CREATE_FIELDS => qw(
 # There are also other, more complex validators that are called
 # from run_create_validators.
 sub VALIDATORS {
+    my $cache = Bugzilla->request_cache;
+    return $cache->{bug_validators} if defined $cache->{bug_validators};
+
     my $validators = {
         alias          => \&_check_alias,
         bug_file_loc   => \&_check_bug_file_loc,
@@ -163,7 +166,8 @@ sub VALIDATORS {
         $validators->{$field->name} = $validator;
     }
 
-    return $validators;
+    $cache->{bug_validators} = $validators;
+    return $cache->{bug_validators};
 };
 
 use constant UPDATE_VALIDATORS => {