summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-12-16 20:17:05 +0100
committerGitHub <noreply@github.com>2017-12-16 20:17:05 +0100
commit334bead74bc9c5e819f14946726eaad40986d636 (patch)
treee7ecf8d4eba2e6a046da8a9dc8828f35b75c7428 /extensions
parent49e0df0d4e1b2f25be4ab36660dac5e47768c9a1 (diff)
downloadbugzilla-334bead74bc9c5e819f14946726eaad40986d636.tar.gz
bugzilla-334bead74bc9c5e819f14946726eaad40986d636.tar.xz
Bug 1403777 - Migrate urlbase from params to localconfig
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BMO/Extension.pm13
-rw-r--r--extensions/BMO/lib/Reports/ReleaseTracking.pm4
-rw-r--r--extensions/Bitly/lib/WebService.pm6
-rw-r--r--extensions/BugModal/lib/ActivityStream.pm2
-rw-r--r--extensions/BzAPI/lib/Resources/Bugzilla.pm4
-rw-r--r--extensions/BzAPI/lib/Util.pm4
-rw-r--r--extensions/GitHubAuth/lib/Client.pm6
-rw-r--r--extensions/GitHubAuth/lib/Login.pm4
-rw-r--r--extensions/InlineHistory/Extension.pm4
-rw-r--r--extensions/Persona/lib/Login.pm2
-rw-r--r--extensions/PhabBugz/lib/WebService.pm4
-rw-r--r--extensions/Push/lib/Connector.disabled/AMQP.pm2
-rw-r--r--extensions/Push/lib/Connector.disabled/ServiceNow.pm2
-rw-r--r--extensions/Push/lib/Connector/Spark.pm4
-rw-r--r--extensions/SecureMail/Extension.pm6
-rw-r--r--extensions/SiteMapIndex/Extension.pm8
-rw-r--r--extensions/SiteMapIndex/lib/Util.pm8
-rw-r--r--extensions/Splinter/lib/Util.pm2
18 files changed, 40 insertions, 45 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index db672f82a..e69d6f1e2 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -1532,8 +1532,8 @@ sub field_end_of_create {
# Create an IT bug so Mozilla's DBAs so they can update the grants for metrics
- if (Bugzilla->params->{'urlbase'} ne 'https://bugzilla.mozilla.org/'
- && Bugzilla->params->{'urlbase'} ne 'https://bugzilla.allizom.org/')
+ if (Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.mozilla.org/'
+ && Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.allizom.org/')
{
return;
}
@@ -2544,11 +2544,6 @@ sub install_filesystem {
my $contribute = eval {
$json->decode(scalar read_file(bz_locations()->{cgi_path} . "/contribute.json"));
};
- my $commit = $ENV{CIRCLE_SHA1};
- unless ($commit) {
- $commit = `git rev-parse HEAD`;
- chomp $commit;
- }
if (!$contribute) {
die "Missing or invalid contribute.json file";
@@ -2557,8 +2552,8 @@ sub install_filesystem {
my $version_obj = {
source => $contribute->{repository}{url},
version => BUGZILLA_VERSION,
- commit => $commit // "unknown",
- build => $ENV{CIRCLE_BUILD_NUM} // "unknown",
+ commit => $ENV{CIRCLE_SHA1} // 'unknown',
+ build => $ENV{CIRCLE_BUILD_NUM} // 'unknown',
};
$create_files->{'version.json'} = {
diff --git a/extensions/BMO/lib/Reports/ReleaseTracking.pm b/extensions/BMO/lib/Reports/ReleaseTracking.pm
index b6c7c4520..42ef24b47 100644
--- a/extensions/BMO/lib/Reports/ReleaseTracking.pm
+++ b/extensions/BMO/lib/Reports/ReleaseTracking.pm
@@ -16,7 +16,7 @@ use Bugzilla::Error;
use Bugzilla::Extension::BMO::Util;
use Bugzilla::Field;
use Bugzilla::FlagType;
-use Bugzilla::Util qw(correct_urlbase trick_taint validate_date);
+use Bugzilla::Util qw(trick_taint validate_date);
use JSON qw(-convert_blessed_universally);
use List::MoreUtils qw(uniq);
@@ -434,7 +434,7 @@ sub report {
my $bugs = $dbh->selectcol_arrayref($query, undef, @params);
push @$bugs, 0 unless @$bugs;
- my $urlbase = correct_urlbase();
+ my $urlbase = Bugzilla->localconfig->{urlbase};
my $cgi = Bugzilla->cgi;
print $cgi->redirect(
-url => "${urlbase}buglist.cgi?bug_id=" . join(',', @$bugs)
diff --git a/extensions/Bitly/lib/WebService.pm b/extensions/Bitly/lib/WebService.pm
index b8ada56d2..4b44faa0e 100644
--- a/extensions/Bitly/lib/WebService.pm
+++ b/extensions/Bitly/lib/WebService.pm
@@ -18,7 +18,7 @@ use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Search;
use Bugzilla::Search::Quicksearch;
-use Bugzilla::Util 'correct_urlbase';
+use Bugzilla::Util ();
use Bugzilla::WebService::Util 'validate';
use JSON;
use LWP::UserAgent;
@@ -47,7 +47,7 @@ sub _validate_uri {
my $uri = URI->new($url);
$uri->query(undef);
$uri->fragment(undef);
- if ($uri->as_string ne correct_urlbase() . 'buglist.cgi') {
+ if ($uri->as_string ne Bugzilla->localconfig->{urlbase} . 'buglist.cgi') {
ThrowUserError('bitly_unsupported');
}
@@ -82,7 +82,7 @@ sub list {
my $data = $search->data;
# form a bug_id only url, sanity check the length
- $uri = URI->new(correct_urlbase() . 'buglist.cgi?bug_id=' . join(',', map { $_->[0] } @$data));
+ $uri = URI->new(Bugzilla->localconfig->{urlbase} . 'buglist.cgi?bug_id=' . join(',', map { $_->[0] } @$data));
if (length($uri->as_string) > CGI_URI_LIMIT) {
ThrowUserError('bitly_failure', { message => "Too many bugs returned by search" });
}
diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm
index 708c056d4..098c5df33 100644
--- a/extensions/BugModal/lib/ActivityStream.pm
+++ b/extensions/BugModal/lib/ActivityStream.pm
@@ -274,7 +274,7 @@ sub _add_activities_to_stream {
# split see-also
if ($change->{fieldname} eq 'see_also') {
- my $url_base = correct_urlbase();
+ my $url_base = Bugzilla->localconfig->{urlbase};
foreach my $f (qw( added removed )) {
my @values;
foreach my $value (split(/, /, $change->{$f})) {
diff --git a/extensions/BzAPI/lib/Resources/Bugzilla.pm b/extensions/BzAPI/lib/Resources/Bugzilla.pm
index accbf71a7..6e350d839 100644
--- a/extensions/BzAPI/lib/Resources/Bugzilla.pm
+++ b/extensions/BzAPI/lib/Resources/Bugzilla.pm
@@ -18,7 +18,7 @@ use Bugzilla::Keyword;
use Bugzilla::Product;
use Bugzilla::Status;
use Bugzilla::Field;
-use Bugzilla::Util qw(correct_urlbase);
+use Bugzilla::Util ();
use Bugzilla::Extension::BzAPI::Constants;
@@ -143,7 +143,7 @@ sub get_configuration {
sub get_empty {
my ($self) = @_;
return {
- ref => $self->type('string', correct_urlbase() . "bzapi/"),
+ ref => $self->type('string', Bugzilla->localconfig->{urlbase} . "bzapi/"),
documentation => $self->type('string', BZAPI_DOC),
version => $self->type('string', BUGZILLA_VERSION)
};
diff --git a/extensions/BzAPI/lib/Util.pm b/extensions/BzAPI/lib/Util.pm
index ac5e8cbd1..d50679a6c 100644
--- a/extensions/BzAPI/lib/Util.pm
+++ b/extensions/BzAPI/lib/Util.pm
@@ -21,7 +21,7 @@ use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::Extension::BzAPI::Constants;
use Bugzilla::Token;
-use Bugzilla::Util qw(correct_urlbase email_filter);
+use Bugzilla::Util qw(email_filter);
use Bugzilla::WebService::Util qw(filter_wants);
use MIME::Base64;
@@ -44,7 +44,7 @@ our @EXPORT = qw(
# Return an URL base appropriate for constructing a ref link
# normally required by REST API calls.
sub ref_urlbase {
- return correct_urlbase() . "bzapi";
+ return Bugzilla->localconfig->{urlbase} . "bzapi";
}
# convert certain fields within a bug object
diff --git a/extensions/GitHubAuth/lib/Client.pm b/extensions/GitHubAuth/lib/Client.pm
index 46c070856..291501961 100644
--- a/extensions/GitHubAuth/lib/Client.pm
+++ b/extensions/GitHubAuth/lib/Client.pm
@@ -17,7 +17,7 @@ use URI::QueryParam;
use Digest;
use Bugzilla::Extension::GitHubAuth::Client::Error qw(ThrowUserError ThrowCodeError);
-use Bugzilla::Util qw(remote_ip correct_urlbase);
+use Bugzilla::Util qw(remote_ip);
use constant DIGEST_HASH => 'SHA1';
@@ -39,7 +39,7 @@ sub new {
sub login_uri {
my ($class, $target_uri) = @_;
- my $uri = URI->new(correct_urlbase() . "github.cgi");
+ my $uri = URI->new(Bugzilla->localconfig->{urlbase} . "github.cgi");
$uri->query_form(target_uri => $target_uri);
return $uri;
}
@@ -52,7 +52,7 @@ sub authorize_uri {
client_id => Bugzilla->params->{github_client_id},
scope => 'user:email',
state => $state,
- redirect_uri => correct_urlbase() . "github.cgi",
+ redirect_uri => Bugzilla->localconfig->{urlbase} . "github.cgi",
);
return $uri;
diff --git a/extensions/GitHubAuth/lib/Login.pm b/extensions/GitHubAuth/lib/Login.pm
index 3f81467d0..073fbfeea 100644
--- a/extensions/GitHubAuth/lib/Login.pm
+++ b/extensions/GitHubAuth/lib/Login.pm
@@ -17,7 +17,7 @@ use fields qw(github_failure);
use Scalar::Util qw(blessed);
use Bugzilla::Constants qw(AUTH_NODATA AUTH_ERROR USAGE_MODE_BROWSER);
-use Bugzilla::Util qw(trick_taint correct_urlbase generate_random_password);
+use Bugzilla::Util qw(trick_taint generate_random_password);
use Bugzilla::Token qw(issue_short_lived_session_token set_token_extra_data);
use List::MoreUtils qw(any);
use Bugzilla::Extension::GitHubAuth::Client;
@@ -201,7 +201,7 @@ sub _mk_choose_email {
return sub {
my $email = shift;
- my $uri = URI->new(correct_urlbase() . "github.cgi");
+ my $uri = URI->new(Bugzilla->localconfig->{urlbase} . "github.cgi");
$uri->query_form( state => $state, email => $email );
return $uri;
};
diff --git a/extensions/InlineHistory/Extension.pm b/extensions/InlineHistory/Extension.pm
index fb4a8f98f..adbfa4c74 100644
--- a/extensions/InlineHistory/Extension.pm
+++ b/extensions/InlineHistory/Extension.pm
@@ -16,7 +16,7 @@ use base qw(Bugzilla::Extension);
use Bugzilla::User::Setting;
use Bugzilla::Constants;
use Bugzilla::Attachment;
-use Bugzilla::Util 'correct_urlbase';
+use Bugzilla::Util ();
our $VERSION = '1.5';
@@ -132,7 +132,7 @@ sub template_before_process {
# split see-also
if ($change->{fieldname} eq 'see_also') {
- my $url_base = correct_urlbase();
+ my $url_base = Bugzilla->localconfig->{urlbase};
foreach my $f (qw( added removed )) {
my @values;
foreach my $value (split(/, /, $change->{$f})) {
diff --git a/extensions/Persona/lib/Login.pm b/extensions/Persona/lib/Login.pm
index b9ba97a7e..9a5e3a5b7 100644
--- a/extensions/Persona/lib/Login.pm
+++ b/extensions/Persona/lib/Login.pm
@@ -43,7 +43,7 @@ sub get_login_info {
$cgi->delete('token');
check_hash_token($token, ['login']);
- my $urlbase = new URI(correct_urlbase());
+ my $urlbase = new URI(Bugzilla->localconfig->{urlbase});
my $audience = $urlbase->scheme . "://" . $urlbase->host_port;
my $ua = new LWP::UserAgent( timeout => 10 );
diff --git a/extensions/PhabBugz/lib/WebService.pm b/extensions/PhabBugz/lib/WebService.pm
index 738077880..0ff2d46f9 100644
--- a/extensions/PhabBugz/lib/WebService.pm
+++ b/extensions/PhabBugz/lib/WebService.pm
@@ -20,7 +20,7 @@ use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Extension::Push::Util qw(is_public);
use Bugzilla::User;
-use Bugzilla::Util qw(correct_urlbase detaint_natural);
+use Bugzilla::Util qw(detaint_natural);
use Bugzilla::WebService::Constants;
use Bugzilla::Extension::PhabBugz::Constants;
@@ -111,7 +111,7 @@ sub revision {
return {
result => $result,
attachment_id => $attachment->id,
- attachment_link => correct_urlbase() . "attachment.cgi?id=" . $attachment->id
+ attachment_link => Bugzilla->localconfig->{urlbase} . "attachment.cgi?id=" . $attachment->id
};
}
diff --git a/extensions/Push/lib/Connector.disabled/AMQP.pm b/extensions/Push/lib/Connector.disabled/AMQP.pm
index f712ee890..1ba365e21 100644
--- a/extensions/Push/lib/Connector.disabled/AMQP.pm
+++ b/extensions/Push/lib/Connector.disabled/AMQP.pm
@@ -27,7 +27,7 @@ sub init {
if ($self->config->{queue}) {
$self->{queue_name} = $self->config->{queue};
} else {
- my $queue_name = Bugzilla->params->{'urlbase'};
+ my $queue_name = Bugzilla->localconfig->{'urlbase'};
$queue_name =~ s#^https?://##;
$queue_name =~ s#/$#|#;
$queue_name .= generate_random_password(16);
diff --git a/extensions/Push/lib/Connector.disabled/ServiceNow.pm b/extensions/Push/lib/Connector.disabled/ServiceNow.pm
index a6d84cbe0..d0ebdcf10 100644
--- a/extensions/Push/lib/Connector.disabled/ServiceNow.pm
+++ b/extensions/Push/lib/Connector.disabled/ServiceNow.pm
@@ -241,7 +241,7 @@ sub send {
$request->content(to_json($data));
$request->authorization_basic($self->config->{service_now_user}, $self->config->{service_now_pass});
- $self->{lwp} ||= LWP::UserAgent->new(agent => Bugzilla->params->{urlbase});
+ $self->{lwp} ||= LWP::UserAgent->new(agent => Bugzilla->localconfig->{urlbase});
my $result = $self->{lwp}->request($request);
# http level errors
diff --git a/extensions/Push/lib/Connector/Spark.pm b/extensions/Push/lib/Connector/Spark.pm
index 3194bd3ab..e58ddfbe4 100644
--- a/extensions/Push/lib/Connector/Spark.pm
+++ b/extensions/Push/lib/Connector/Spark.pm
@@ -18,7 +18,7 @@ use Bugzilla::Extension::Push::Constants;
use Bugzilla::Extension::Push::Util;
use Bugzilla::Bug;
use Bugzilla::Attachment;
-use Bugzilla::Util qw(correct_urlbase);
+use Bugzilla::Util ();
use JSON qw(decode_json encode_json);
use LWP::UserAgent;
@@ -108,7 +108,7 @@ sub send {
}
}
}
- $text .= correct_urlbase() . "show_bug.cgi?id=" . $bug->id;
+ $text .= Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=" . $bug->id;
my $room_id = $self->config->{spark_room_id};
my $message_uri = $self->_spark_uri('messages');
diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm
index 0219ac3ba..d684b5a39 100644
--- a/extensions/SecureMail/Extension.pm
+++ b/extensions/SecureMail/Extension.pm
@@ -32,7 +32,7 @@ use Bugzilla::Comment;
use Bugzilla::Group;
use Bugzilla::Object;
use Bugzilla::User;
-use Bugzilla::Util qw(correct_urlbase trim trick_taint is_7bit_clean);
+use Bugzilla::Util qw(trim trick_taint is_7bit_clean);
use Bugzilla::Error;
use Bugzilla::Mailer;
@@ -568,7 +568,7 @@ sub _make_secure {
my $message;
my $email_type = $email->header('X-Bugzilla-Type');
my $vars = {
- 'urlbase' => correct_urlbase(),
+ 'urlbase' => Bugzilla->localconfig->{urlbase},
'bug_id' => $bug_id,
'maintainer' => Bugzilla->params->{'maintainer'},
'email_type' => $email_type
@@ -622,7 +622,7 @@ sub _pgp_encrypt {
Data => $encrypted,
Object => 'MESSAGE',
Headers => {
- Comment => correct_urlbase() . ($bug_id ? 'show_bug.cgi?id=' . $bug_id : ''),
+ Comment => Bugzilla->localconfig->{urlbase} . ($bug_id ? 'show_bug.cgi?id=' . $bug_id : ''),
},
);
# until Crypt::OpenPGP makes the Version header optional we have to strip
diff --git a/extensions/SiteMapIndex/Extension.pm b/extensions/SiteMapIndex/Extension.pm
index a3f093485..3d4342e0e 100644
--- a/extensions/SiteMapIndex/Extension.pm
+++ b/extensions/SiteMapIndex/Extension.pm
@@ -31,7 +31,7 @@ use base qw(Bugzilla::Extension);
our $VERSION = '1.0';
use Bugzilla::Constants qw(bz_locations ON_WINDOWS);
-use Bugzilla::Util qw(correct_urlbase get_text);
+use Bugzilla::Util qw(get_text);
use Bugzilla::Install::Filesystem;
use Bugzilla::Extension::SiteMapIndex::Constants;
@@ -80,7 +80,7 @@ sub page_before_template {
sub install_before_final_checks {
my ($self) = @_;
- if (!correct_urlbase()) {
+ if (!Bugzilla->localconfig->{urlbase}) {
print STDERR get_text('sitemap_no_urlbase'), "\n";
return;
}
@@ -89,7 +89,7 @@ sub install_before_final_checks {
return;
}
- return if (correct_urlbase() ne 'https://bugzilla.mozilla.org/');
+ return if (Bugzilla->localconfig->{urlbase} ne 'https://bugzilla.mozilla.org/');
}
sub install_filesystem {
@@ -126,7 +126,7 @@ EOT
sub before_robots_txt {
my ($self, $args) = @_;
- $args->{vars}{SITEMAP_URL} = correct_urlbase() . SITEMAP_URL;
+ $args->{vars}{SITEMAP_URL} = Bugzilla->localconfig->{urlbase} . SITEMAP_URL;
}
__PACKAGE__->NAME;
diff --git a/extensions/SiteMapIndex/lib/Util.pm b/extensions/SiteMapIndex/lib/Util.pm
index 3548e5af5..4519461b4 100644
--- a/extensions/SiteMapIndex/lib/Util.pm
+++ b/extensions/SiteMapIndex/lib/Util.pm
@@ -34,7 +34,7 @@ our @EXPORT = qw(
use Bugzilla::Extension::SiteMapIndex::Constants;
-use Bugzilla::Util qw(correct_urlbase datetime_from url_quote);
+use Bugzilla::Util qw(datetime_from url_quote);
use Bugzilla::Constants qw(bz_locations);
use Scalar::Util qw(blessed);
@@ -144,7 +144,7 @@ END
foreach my $filename (@$filelist) {
$index_xml .= "
<sitemap>
- <loc>" . correct_urlbase() . "data/$extension_name/$filename</loc>
+ <loc>" . Bugzilla->localconfig->{urlbase} . "data/$extension_name/$filename</loc>
<lastmod>$timestamp</lastmod>
</sitemap>
";
@@ -166,8 +166,8 @@ END
sub _generate_sitemap_file {
my ($extension_name, $filecount, $products, $bugs) = @_;
- my $bug_url = correct_urlbase() . 'show_bug.cgi?id=';
- my $product_url = correct_urlbase() . 'describecomponents.cgi?product=';
+ my $bug_url = Bugzilla->localconfig->{urlbase} . 'show_bug.cgi?id=';
+ my $product_url = Bugzilla->localconfig->{urlbase} . 'describecomponents.cgi?product=';
my $sitemap_xml = <<END;
<?xml version="1.0" encoding="UTF-8"?>
diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm
index d85b0532b..c85bb9b3b 100644
--- a/extensions/Splinter/lib/Util.pm
+++ b/extensions/Splinter/lib/Util.pm
@@ -88,7 +88,7 @@ sub attachment_id_is_patch {
sub get_review_base {
my $base = Bugzilla->params->{'splinter_base'};
$base =~ s!/$!!;
- my $urlbase = correct_urlbase();
+ my $urlbase = Bugzilla->localconfig->{urlbase};
$urlbase =~ s!/$!! if $base =~ "^/";
$base = $urlbase . $base;
return $base;