From fbb30d2c53cbbd71c80d58b30d2ec77f3c14d403 Mon Sep 17 00:00:00 2001 From: "mozilla%colinogilvie.co.uk" <> Date: Mon, 19 May 2008 23:38:23 +0000 Subject: Bug 415278: Make the WebService's plugin discovery method more extendable Patch by: Colin Ogilvie ; r=mkanat; a=LpSolit --- Bugzilla/Hook.pm | 11 +++++++---- Bugzilla/WebService/Bugzilla.pm | 25 +++++++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index 7c47b3f3f..0cf566db1 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -69,7 +69,7 @@ sub enabled_plugins { next if -e "$extension/disabled"; # Allow extensions to load their own libraries. local @INC = ("$extension/lib", @INC); - $enabled{$extname} = do("$extension/version.pl"); + $enabled{$extname} = do("$extension/info.pl"); ThrowCodeError('extension_invalid', { errstr => $@, name => 'version', extension => $extension }) if $@; @@ -125,9 +125,12 @@ hook to do anything, you have to modify these variables. =head2 Versioning Extensions -Every extension must have a file in its root called F. -This file should return a version number when called with C. -This represents the current version of this extension. +Every extension must have a file in its root called F. +This file must return a hash when called with C. +The hash must contain a 'version' key with the current version of the +extension. Extension authors can also add any extra infomration to this hash if +required, by adding a new key beginning with x_ which will not be used the +core Bugzilla code. =head1 SUBROUTINES diff --git a/Bugzilla/WebService/Bugzilla.pm b/Bugzilla/WebService/Bugzilla.pm index dde9cfd4b..7b58af254 100755 --- a/Bugzilla/WebService/Bugzilla.pm +++ b/Bugzilla/WebService/Bugzilla.pm @@ -36,12 +36,16 @@ sub version { return { version => type('string')->value(BUGZILLA_VERSION) }; } -sub plugins { - my $plugins = Bugzilla::Hook::enabled_plugins(); - foreach my $name (keys %$plugins) { - $plugins->{$name} = type('string')->value($plugins->{$name}); +sub extensions { + my $extensions = Bugzilla::Hook::enabled_plugins(); + foreach my $name (keys %$extensions) { + my $info = $extensions->{$name}; + foreach my $data (keys %$info) + { + $extensions->{$name}->{$data} = type('string')->value($info->{$data}); + } } - return { plugins => $plugins }; + return { extensions => $extensions }; } sub timezone { @@ -89,22 +93,23 @@ string. =back -=item C B +=item C B =over =item B -Gets information about the plugins that are currently installed and enabled +Gets information about the extensions that are currently installed and enabled in this Bugzilla. =item B (none) =item B -A hash with a single item, C. This points to a hash. I hash -contains the names of plugins as keys, and the versions of the plugin as -values. +A hash with a single item, C. This points to a hash. I hash +contains the names of extensions as keys, and information about the extension +as values. One of the values that must be returned is the 'version' of the +extension =back -- cgit v1.2.3-24-g4f1b