summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Template.pm32
1 files changed, 23 insertions, 9 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 49294244a..40079339a 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -1153,18 +1153,32 @@ sub create {
# These don't work as normal constants.
DB_MODULE => \&Bugzilla::Constants::DB_MODULE,
- REQUIRED_MODULES =>
- \&Bugzilla::Install::Requirements::REQUIRED_MODULES,
+ REQUIRED_MODULES => sub {
+ my %required_modules;
+ my $cache = Bugzilla->request_cache;
+ my $meta = $cache->{cpan_meta} ||= Bugzilla::Install::Requirements::load_cpan_meta();
+ my $reqs = $meta->effective_prereqs->merged_requirements(['configure', 'runtime'], ['requires']);
+ foreach my $module (sort $reqs->required_modules) {
+ next if $module eq 'perl';
+ $required_modules{$module} = { version => $reqs->requirements_for_module($module) };
+ }
+ return \%required_modules;
+ },
OPTIONAL_MODULES => sub {
- my @optional = @{OPTIONAL_MODULES()};
- foreach my $item (@optional) {
- my @features;
- foreach my $feat_id (@{ $item->{feature} }) {
- push(@features, install_string("feature_$feat_id"));
+ my %optional_modules;
+ my $cache = Bugzilla->request_cache;
+ my $meta = $cache->{cpan_meta} ||= Bugzilla::Install::Requirements::load_cpan_meta();
+ foreach my $feature ($meta->features) {
+ my $reqs = $feature->prereqs->merged_requirements(['configure', 'runtime'], ['requires']);
+ foreach my $module ($reqs->required_modules) {
+ my $version = $reqs->requirements_for_module($module);
+ $optional_modules{$module} ||= {};
+ $optional_modules{$module}{version} = $version;
+ $optional_modules{$module}{features} ||= [];
+ push(@{$optional_modules{$module}{features}}, $feature->description);
}
- $item->{feature} = \@features;
}
- return \@optional;
+ return \%optional_modules;
},
'default_authorizer' => sub { return Bugzilla::Auth->new() },