diff options
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r-- | Bugzilla.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm index 3aa6e5489..4b19301aa 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -209,6 +209,20 @@ sub extensions { return $cache->{extensions}; } +sub api_server { + my $class = shift; + my $cache = $class->request_cache; + return $cache->{api_server} if defined $cache->{api_server}; + require Bugzilla::API::Server; + $cache->{api_server} = Bugzilla::API::Server->server; + if (my $load_error = $cache->{api_server}->load_error) { + my @error_params = ($load_error->{error}, $load_error->{vars}); + ThrowCodeError(@error_params) if $load_error->{type} eq 'code'; + ThrowUserError(@error_params) if $load_error->{type} eq 'user'; + } + return $cache->{api_server}; +} + sub feature { my ($class, $feature) = @_; my $cache = $class->request_cache; @@ -980,6 +994,11 @@ this Bugzilla installation. Tells you whether or not a specific feature is enabled. For names of features, see C<OPTIONAL_MODULES> in C<Bugzilla::Install::Requirements>. +=item C<api_server> + +Returns a cached instance of the WebService API server object used for +manipulating Bugzilla resources. + =back =head1 B<CACHING> |