to a new 'MoreBugUrl' extension.
r/a=LpSolit
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Constants;
+use Bugzilla::Hook;
use URI::QueryParam;
Bugzilla::BugUrl::Trac
Bugzilla::BugUrl::MantisBT
Bugzilla::BugUrl::SourceForge
- Bugzilla::BugUrl::ReviewBoard
- Bugzilla::BugUrl::Rietveld
);
###############################
sub class_for {
my ($class, $value) = @_;
+ my @sub_classes = $class->SUB_CLASSES;
+ Bugzilla::Hook::process("bug_url_sub_classes",
+ { sub_classes => \@sub_classes });
+
my $uri = URI->new($value);
- foreach my $subclass ($class->SUB_CLASSES) {
+ foreach my $subclass (@sub_classes) {
eval "use $subclass";
die $@ if $@;
return wantarray ? ($subclass, $uri) : $subclass
=back
+=head2 bug_url_sub_classes
+
+Allows you to add more L<Bugzilla::BugUrl> sub-classes.
+
+See the C<MoreBugUrl> extension to see how things work.
+
+Params:
+
+=over
+
+=item C<sub_classes> - An arrayref of strings which represent L<Bugzilla::BugUrl>
+sub-classes.
+
+=back
+
=head2 buglist_columns
This happens in L<Bugzilla::Search/COLUMNS>, which determines legal bug
--- /dev/null
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::Extension::MoreBugUrl;
+use strict;
+
+use constant NAME => 'MoreBugUrl';
+
+use constant REQUIRED_MODULES => [
+];
+
+use constant OPTIONAL_MODULES => [
+];
+
+__PACKAGE__->NAME;
--- /dev/null
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::Extension::MoreBugUrl;
+use strict;
+use base qw(Bugzilla::Extension);
+
+use constant MORE_SUB_CLASSES => qw(
+ Bugzilla::Extension::MoreBugUrl::ReviewBoard
+ Bugzilla::Extension::MoreBugUrl::Rietveld
+);
+
+# We need to update bug_see_also table because both
+# Rietveld and ReviewBoard were originally under Bugzilla/BugUrl/.
+sub install_update_db {
+ my $dbh = Bugzilla->dbh;
+
+ my $should_rename = $dbh->selectrow_array(
+ q{SELECT 1 FROM bug_see_also
+ WHERE class IN ('Bugzilla::BugUrl::Rietveld',
+ 'Bugzilla::BugUrl::ReviewBoard')});
+
+ if ($should_rename) {
+ my $sth = $dbh->prepare('UPDATE bug_see_also SET class = ?
+ WHERE class = ?');
+ $sth->execute('Bugzilla::Extension::MoreBugUrl::ReviewBoard',
+ 'Bugzilla::BugUrl::ReviewBoard');
+
+ $sth->execute('Bugzilla::Extension::MoreBugUrl::Rietveld',
+ 'Bugzilla::BugUrl::Rietveld');
+ }
+}
+
+sub bug_url_sub_classes {
+ my ($self, $args) = @_;
+ push @{ $args->{sub_classes} }, MORE_SUB_CLASSES;
+}
+
+__PACKAGE__->NAME;
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::BugUrl::ReviewBoard;
+package Bugzilla::Extension::MoreBugUrl::ReviewBoard;
use strict;
use base qw(Bugzilla::BugUrl);
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::BugUrl::Rietveld;
+package Bugzilla::Extension::MoreBugUrl::Rietveld;
use strict;
use base qw(Bugzilla::BugUrl);
--- /dev/null
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+<li>A Review Board review request.</li>
+<li>An issue in a Rietveld installation.</li>
<li>A ticket in a Trac installation.</li>
<li>A b[% %]ug in a MantisBT installation.</li>
<li>A b[% %]ug on sourceforge.net.</li>
- <li>A Review Board review request.</li>
- <li>An issue in a Rietveld installation.</li>
+ [% Hook.process('bug_url_invalid_tracker') %]
</ul>
[% ELSIF reason == 'id' %]
There is no valid [% terms.bug %] id in that URL.