From dc6eca0cc8ab4dd41a5b5f618fa8e49b0fe194f7 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Sat, 25 Mar 2017 23:13:07 -0400 Subject: Bug 1350467 - Add method Bugzilla->preload_features() to be called in mod_perl.pl startup --- Bugzilla/CPAN.pm | 13 +++++++++++++ mod_perl.pl | 2 ++ 2 files changed, 15 insertions(+) diff --git a/Bugzilla/CPAN.pm b/Bugzilla/CPAN.pm index f044e45bc..1ffac601c 100644 --- a/Bugzilla/CPAN.pm +++ b/Bugzilla/CPAN.pm @@ -104,6 +104,16 @@ sub feature { return $FEATURE_LOADED{$feature_name} = 1; } +sub preload_features { + my ($class) = @_; + return 0 unless _CAN_HAS_FEATURE; + my $meta = $class->cpan_meta; + + foreach my $feature ($meta->features) { + $class->feature($feature->identifier); + } +} + 1; __END__ @@ -140,3 +150,6 @@ are installed. Returns a L from the contents of MYMETA.json in the bugzilla directory. +=head2 C + +Attempts to load all features. diff --git a/mod_perl.pl b/mod_perl.pl index bbca30c2e..920032fe7 100644 --- a/mod_perl.pl +++ b/mod_perl.pl @@ -93,6 +93,8 @@ $server->add_config([split("\n", $conf)]); # Pre-load all extensions $Bugzilla::extension_packages = Bugzilla::Extension->load_all(); +Bugzilla->preload_features(); + # Have ModPerl::RegistryLoader pre-compile all CGI scripts. my $rl = new ModPerl::RegistryLoader(); # If we try to do this in "new" it fails because it looks for a -- cgit v1.2.3-24-g4f1b