]> git.ipfire.org Git - thirdparty/bugzilla.git/blob - xmlrpc.cgi
Move Directory out of VirtualHost (5.2) (#120)
[thirdparty/bugzilla.git] / xmlrpc.cgi
1 #!/usr/bin/perl -T
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 #
6 # This Source Code Form is "Incompatible With Secondary Licenses", as
7 # defined by the Mozilla Public License, v. 2.0.
8
9 use 5.10.1;
10 use strict;
11 use warnings;
12
13 use lib qw(. lib);
14
15 use Bugzilla;
16 use Bugzilla::Constants;
17 use Bugzilla::Error;
18 use Bugzilla::WebService::Constants;
19
20 BEGIN {
21 if (!Bugzilla->feature('xmlrpc')) {
22 ThrowUserError('feature_disabled', {feature => 'xmlrpc'});
23 }
24 }
25 use Bugzilla::WebService::Server::XMLRPC;
26
27 Bugzilla->usage_mode(USAGE_MODE_XMLRPC);
28
29 # Fix the error code that SOAP::Lite uses for Perl errors.
30 local $SOAP::Constants::FAULT_SERVER;
31 $SOAP::Constants::FAULT_SERVER = ERROR_UNKNOWN_FATAL;
32
33 # The line above is used, this one is ignored, but SOAP::Lite
34 # might start using this constant (the correct one) for XML-RPC someday.
35 local $XMLRPC::Constants::FAULT_SERVER;
36 $XMLRPC::Constants::FAULT_SERVER = ERROR_UNKNOWN_FATAL;
37
38 local @INC = (bz_locations()->{extensionsdir}, @INC);
39 my $server = new Bugzilla::WebService::Server::XMLRPC;
40
41 # We use a sub for on_action because that gets us the info about what
42 # class is being called. Note that this is a hack--this is technically
43 # for setting SOAPAction, which isn't used by XML-RPC.
44 $server->on_action(sub { $server->handle_login(WS_DISPATCH, @_) })->handle();