summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2011-12-21 18:42:51 +0100
committerDave Lawrence <dlawrence@mozilla.com>2011-12-21 18:42:51 +0100
commiteca4822f0ad4733af64425c10b9edd1d7ca62772 (patch)
tree1f7684f00e053b80a6d0ffadf1aa147e4e9e2fc4 /Bugzilla.pm
parent5cbb1c79abf94ffdd55f554c910da64cd9782503 (diff)
downloadbugzilla-eca4822f0ad4733af64425c10b9edd1d7ca62772.tar.gz
bugzilla-eca4822f0ad4733af64425c10b9edd1d7ca62772.tar.xz
merged with bmo/4.0
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index 65ddcc2bc..29467ef1f 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -42,6 +42,7 @@ use Bugzilla::Auth::Persist::Cookie;
use Bugzilla::CGI;
use Bugzilla::Extension;
use Bugzilla::DB;
+use Bugzilla::Hook;
use Bugzilla::Install::Localconfig qw(read_localconfig);
use Bugzilla::Install::Requirements qw(OPTIONAL_MODULES);
use Bugzilla::Install::Util qw(init_console);
@@ -596,12 +597,20 @@ sub fields {
}
sub active_custom_fields {
- my $class = shift;
- if (!exists $class->request_cache->{active_custom_fields}) {
- $class->request_cache->{active_custom_fields} =
- Bugzilla::Field->match({ custom => 1, obsolete => 0 });
+ my ($class, $params) = @_;
+ my $cache_id = 'active_custom_fields';
+ if ($params) {
+ $cache_id .= ($params->{product} ? '_p' . $params->{product}->id : '') .
+ ($params->{component} ? '_c' . $params->{component}->id : '') .
+ ($params->{type} ? '_t' . $params->{type} : '');
+ }
+ if (!exists $class->request_cache->{$cache_id}) {
+ my $fields = Bugzilla::Field->match({ custom => 1, obsolete => 0});
+ Bugzilla::Hook::process('active_custom_fields',
+ { fields => \$fields, params => $params });
+ $class->request_cache->{$cache_id} = $fields;
}
- return @{$class->request_cache->{active_custom_fields}};
+ return @{$class->request_cache->{$cache_id}};
}
sub has_flags {