Bugzilla.pm 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. # -*- Mode: perl; indent-tabs-mode: nil -*-
  2. #
  3. # The contents of this file are subject to the Mozilla Public
  4. # License Version 1.1 (the "License"); you may not use this file
  5. # except in compliance with the License. You may obtain a copy of
  6. # the License at http://www.mozilla.org/MPL/
  7. #
  8. # Software distributed under the License is distributed on an "AS
  9. # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10. # implied. See the License for the specific language governing
  11. # rights and limitations under the License.
  12. #
  13. # The Original Code is the Bugzilla Bug Tracking System.
  14. #
  15. # Contributor(s): Marc Schumann <wurblzap@gmail.com>
  16. # Max Kanat-Alexander <mkanat@bugzilla.org>
  17. # Mads Bondo Dydensborg <mbd@dbc.dk>
  18. package Bugzilla::WebService::Bugzilla;
  19. use strict;
  20. use base qw(Bugzilla::WebService);
  21. use Bugzilla::Constants;
  22. use Bugzilla::Hook;
  23. import SOAP::Data qw(type);
  24. use Time::Zone;
  25. # Basic info that is needed before logins
  26. use constant LOGIN_EXEMPT => {
  27. timezone => 1,
  28. version => 1,
  29. };
  30. sub version {
  31. return { version => type('string')->value(BUGZILLA_VERSION) };
  32. }
  33. sub extensions {
  34. my $extensions = Bugzilla::Hook::enabled_plugins();
  35. foreach my $name (keys %$extensions) {
  36. my $info = $extensions->{$name};
  37. foreach my $data (keys %$info)
  38. {
  39. $extensions->{$name}->{$data} = type('string')->value($info->{$data});
  40. }
  41. }
  42. return { extensions => $extensions };
  43. }
  44. sub timezone {
  45. my $offset = tz_offset();
  46. $offset = (($offset / 60) / 60) * 100;
  47. $offset = sprintf('%+05d', $offset);
  48. return { timezone => type('string')->value($offset) };
  49. }
  50. 1;
  51. __END__
  52. =head1 NAME
  53. Bugzilla::WebService::Bugzilla - Global functions for the webservice interface.
  54. =head1 DESCRIPTION
  55. This provides functions that tell you about Bugzilla in general.
  56. =head1 METHODS
  57. See L<Bugzilla::WebService> for a description of how parameters are passed,
  58. and what B<STABLE>, B<UNSTABLE>, and B<EXPERIMENTAL> mean.
  59. =over
  60. =item C<version>
  61. B<STABLE>
  62. =over
  63. =item B<Description>
  64. Returns the current version of Bugzilla.
  65. =item B<Params> (none)
  66. =item B<Returns>
  67. A hash with a single item, C<version>, that is the version as a
  68. string.
  69. =item B<Errors> (none)
  70. =back
  71. =item C<extensions>
  72. B<EXPERIMENTAL>
  73. =over
  74. =item B<Description>
  75. Gets information about the extensions that are currently installed and enabled
  76. in this Bugzilla.
  77. =item B<Params> (none)
  78. =item B<Returns>
  79. A hash with a single item, C<extesions>. This points to a hash. I<That> hash
  80. contains the names of extensions as keys, and information about the extension
  81. as values. One of the values that must be returned is the 'version' of the
  82. extension
  83. =item B<History>
  84. =over
  85. =item Added in Bugzilla B<3.2>.
  86. =back
  87. =back
  88. =item C<timezone>
  89. B<STABLE>
  90. =over
  91. =item B<Description>
  92. Returns the timezone of the server Bugzilla is running on. This is
  93. important because all dates/times that the webservice interface
  94. returns will be in this timezone.
  95. =item B<Params> (none)
  96. =item B<Returns>
  97. A hash with a single item, C<timezone>, that is the timezone offset as a
  98. string in (+/-)XXXX (RFC 2822) format.
  99. =back
  100. =back