summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Bugzilla.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/WebService/Bugzilla.pm')
-rw-r--r--Bugzilla/WebService/Bugzilla.pm120
1 files changed, 60 insertions, 60 deletions
diff --git a/Bugzilla/WebService/Bugzilla.pm b/Bugzilla/WebService/Bugzilla.pm
index 8e95028cb..f8f745a55 100644
--- a/Bugzilla/WebService/Bugzilla.pm
+++ b/Bugzilla/WebService/Bugzilla.pm
@@ -21,77 +21,76 @@ use Try::Tiny;
use DateTime;
# Basic info that is needed before logins
-use constant LOGIN_EXEMPT => {
- timezone => 1,
- version => 1,
-};
+use constant LOGIN_EXEMPT => {timezone => 1, version => 1,};
use constant READ_ONLY => qw(
- extensions
- timezone
- time
- version
- jobqueue_status
+ extensions
+ timezone
+ time
+ version
+ jobqueue_status
);
use constant PUBLIC_METHODS => qw(
- extensions
- time
- timezone
- version
- jobqueue_status
+ extensions
+ time
+ timezone
+ version
+ jobqueue_status
);
sub version {
- my $self = shift;
- return { version => $self->type('string', BUGZILLA_VERSION) };
+ my $self = shift;
+ return {version => $self->type('string', BUGZILLA_VERSION)};
}
sub extensions {
- my $self = shift;
-
- my %retval;
- foreach my $extension (@{ Bugzilla->extensions }) {
- my $version = $extension->VERSION || 0;
- my $name = $extension->NAME;
- $retval{$name}->{version} = $self->type('string', $version);
- }
- return { extensions => \%retval };
+ my $self = shift;
+
+ my %retval;
+ foreach my $extension (@{Bugzilla->extensions}) {
+ my $version = $extension->VERSION || 0;
+ my $name = $extension->NAME;
+ $retval{$name}->{version} = $self->type('string', $version);
+ }
+ return {extensions => \%retval};
}
sub timezone {
- my $self = shift;
- # All Webservices return times in UTC; Use UTC here for backwards compat.
- return { timezone => $self->type('string', "+0000") };
+ my $self = shift;
+
+ # All Webservices return times in UTC; Use UTC here for backwards compat.
+ return {timezone => $self->type('string', "+0000")};
}
sub time {
- my ($self) = @_;
- # All Webservices return times in UTC; Use UTC here for backwards compat.
- # Hardcode values where appropriate
- my $dbh = Bugzilla->dbh;
-
- my $db_time = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
- $db_time = datetime_from($db_time, 'UTC');
- my $now_utc = DateTime->now();
-
- return {
- db_time => $self->type('dateTime', $db_time),
- web_time => $self->type('dateTime', $now_utc),
- web_time_utc => $self->type('dateTime', $now_utc),
- tz_name => $self->type('string', 'UTC'),
- tz_offset => $self->type('string', '+0000'),
- tz_short_name => $self->type('string', 'UTC'),
- };
+ my ($self) = @_;
+
+ # All Webservices return times in UTC; Use UTC here for backwards compat.
+ # Hardcode values where appropriate
+ my $dbh = Bugzilla->dbh;
+
+ my $db_time = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
+ $db_time = datetime_from($db_time, 'UTC');
+ my $now_utc = DateTime->now();
+
+ return {
+ db_time => $self->type('dateTime', $db_time),
+ web_time => $self->type('dateTime', $now_utc),
+ web_time_utc => $self->type('dateTime', $now_utc),
+ tz_name => $self->type('string', 'UTC'),
+ tz_offset => $self->type('string', '+0000'),
+ tz_short_name => $self->type('string', 'UTC'),
+ };
}
sub jobqueue_status {
- my ( $self, $params ) = @_;
+ my ($self, $params) = @_;
- Bugzilla->login(LOGIN_REQUIRED);
+ Bugzilla->login(LOGIN_REQUIRED);
- my $dbh = Bugzilla->dbh;
- my $query = q{
+ my $dbh = Bugzilla->dbh;
+ my $query = q{
SELECT
COUNT(*) AS total,
COALESCE(
@@ -105,17 +104,18 @@ sub jobqueue_status {
ON f.funcid = j.funcid;
};
- my $status;
- try {
- $status = $dbh->selectrow_hashref($query);
- $status->{errors} = 0 + $status->{errors};
- $status->{total} = 0 + $status->{total};
- } catch {
- ERROR($_);
- ThrowCodeError('jobqueue_status_error');
- };
-
- return $status;
+ my $status;
+ try {
+ $status = $dbh->selectrow_hashref($query);
+ $status->{errors} = 0 + $status->{errors};
+ $status->{total} = 0 + $status->{total};
+ }
+ catch {
+ ERROR($_);
+ ThrowCodeError('jobqueue_status_error');
+ };
+
+ return $status;
}
1;