use Bugzilla::Constants;
use Bugzilla::WebService::Constants;
-use Bugzilla::Util;
+use Bugzilla::Hook;
use Carp;
use Data::Dumper;
my $datadir = bz_locations()->{'datadir'};
# If a writable $datadir/errorlog exists, log error details there.
if (-w "$datadir/errorlog") {
+ require Bugzilla::Util;
require Data::Dumper;
my $mesg = "";
for (1..75) { $mesg .= "-"; };
$mesg .= "\n[$$] " . time2str("%D %H:%M:%S ", time());
$mesg .= "$name $error ";
- $mesg .= remote_ip();
+ $mesg .= Bugzilla::Util::remote_ip();
$mesg .= Bugzilla->user->login;
$mesg .= (' actually ' . Bugzilla->sudoer->login) if Bugzilla->sudoer;
$mesg .= "\n";
{
# Clone the hash so we aren't modifying the constant.
my %error_map = %{ WS_ERROR_CODE() };
- require Bugzilla::Hook;
Bugzilla::Hook::process('webservice_error_codes',
{ error_map => \%error_map });
my $code = $error_map{$error};
# Try a template first; but if this one fails too, fall back
# on plain old print statements.
if (!$template->process("global/code-error.html.tmpl", $vars)) {
+ require Bugzilla::Util;
+ import Bugzilla::Util qw(html_quote);
my $maintainer = Bugzilla->params->{'maintainer'};
my $error = html_quote($vars->{'template_error_msg'});
my $error2 = html_quote($template->error());
use Bugzilla::Constants;
use Bugzilla::RNG qw(irand);
+use Bugzilla::Error;
use Date::Parse;
use Date::Format;
$vars ||= {};
$vars->{'message'} = $name;
my $message;
- if (!$template->process('global/message.txt.tmpl', $vars, \$message)) {
- require Bugzilla::Error;
- Bugzilla::Error::ThrowTemplateError($template->error());
- }
+ $template->process('global/message.txt.tmpl', $vars, \$message)
+ || ThrowTemplateError($template->error());
+
# Remove the indenting that exists in messages.html.tmpl.
$message =~ s/^ //gm;
return $message;
my %vars;
# Note: If we suddenly start needing a lot of template_var variables,
# they should move into their own template, not field-descs.
- my $result = $template->process('global/field-descs.none.tmpl',
- { vars => \%vars, in_template_var => 1 });
- # Bugzilla::Error can't be "use"d in Bugzilla::Util.
- if (!$result) {
- require Bugzilla::Error;
- Bugzilla::Error::ThrowTemplateError($template->error);
- }
+ $template->process('global/field-descs.none.tmpl',
+ { vars => \%vars, in_template_var => 1 })
+ || ThrowTemplateError($template->error());
+
$cache->{$lang} = \%vars;
return $vars{$name};
}
sub detect_encoding {
my $data = shift;
- if (!Bugzilla->feature('detect_charset')) {
- require Bugzilla::Error;
- Bugzilla::Error::ThrowCodeError('feature_disabled',
- { feature => 'detect_charset' });
- }
+ Bugzilla->feature('detect_charset')
+ || ThrowCodeError('feature_disabled', { feature => 'detect_charset' });
require Encode::Detect::Detector;
import Encode::Detect::Detector 'detect';