summaryrefslogtreecommitdiffstats
path: root/extensions/SiteMapIndex/Extension.pm
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/SiteMapIndex/Extension.pm')
-rw-r--r--extensions/SiteMapIndex/Extension.pm116
1 files changed, 58 insertions, 58 deletions
diff --git a/extensions/SiteMapIndex/Extension.pm b/extensions/SiteMapIndex/Extension.pm
index 3d4342e0e..c606702ae 100644
--- a/extensions/SiteMapIndex/Extension.pm
+++ b/extensions/SiteMapIndex/Extension.pm
@@ -46,32 +46,32 @@ use POSIX;
#########
sub template_before_process {
- my ($self, $args) = @_;
- my ($vars, $file) = @$args{qw(vars file)};
-
- return if $file ne 'global/header.html.tmpl';
- return unless (exists $vars->{bug} || exists $vars->{bugs});
- my $bugs = exists $vars->{bugs} ? $vars->{bugs} : [$vars->{bug}];
- return if ref $bugs ne 'ARRAY';
-
- foreach my $bug (@$bugs) {
- if (!bug_is_ok_to_index($bug)) {
- $vars->{sitemap_noindex} = 1;
- last;
- }
+ my ($self, $args) = @_;
+ my ($vars, $file) = @$args{qw(vars file)};
+
+ return if $file ne 'global/header.html.tmpl';
+ return unless (exists $vars->{bug} || exists $vars->{bugs});
+ my $bugs = exists $vars->{bugs} ? $vars->{bugs} : [$vars->{bug}];
+ return if ref $bugs ne 'ARRAY';
+
+ foreach my $bug (@$bugs) {
+ if (!bug_is_ok_to_index($bug)) {
+ $vars->{sitemap_noindex} = 1;
+ last;
}
+ }
}
sub page_before_template {
- my ($self, $args) = @_;
- my $page = $args->{page_id};
-
- if ($page =~ m{^sitemap/sitemap\.}) {
- my $map = generate_sitemap(__PACKAGE__->NAME);
- print Bugzilla->cgi->header('text/xml');
- print $map;
- exit;
- }
+ my ($self, $args) = @_;
+ my $page = $args->{page_id};
+
+ if ($page =~ m{^sitemap/sitemap\.}) {
+ my $map = generate_sitemap(__PACKAGE__->NAME);
+ print Bugzilla->cgi->header('text/xml');
+ print $map;
+ exit;
+ }
}
################
@@ -79,54 +79,54 @@ sub page_before_template {
################
sub install_before_final_checks {
- my ($self) = @_;
- if (!Bugzilla->localconfig->{urlbase}) {
- print STDERR get_text('sitemap_no_urlbase'), "\n";
- return;
- }
- if (Bugzilla->params->{'requirelogin'}) {
- print STDERR get_text('sitemap_requirelogin'), "\n";
- return;
- }
-
- return if (Bugzilla->localconfig->{urlbase} ne 'https://bugzilla.mozilla.org/');
+ my ($self) = @_;
+ if (!Bugzilla->localconfig->{urlbase}) {
+ print STDERR get_text('sitemap_no_urlbase'), "\n";
+ return;
+ }
+ if (Bugzilla->params->{'requirelogin'}) {
+ print STDERR get_text('sitemap_requirelogin'), "\n";
+ return;
+ }
+
+ return if (Bugzilla->localconfig->{urlbase} ne 'https://bugzilla.mozilla.org/');
}
sub install_filesystem {
- my ($self, $args) = @_;
- my $create_dirs = $args->{'create_dirs'};
- my $recurse_dirs = $args->{'recurse_dirs'};
- my $htaccess = $args->{'htaccess'};
-
- # Create the sitemap directory to store the index and sitemap files
- my $sitemap_path = bz_locations->{'datadir'} . "/" . __PACKAGE__->NAME;
-
- $create_dirs->{$sitemap_path} = Bugzilla::Install::Filesystem::DIR_CGI_WRITE
- | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE;
-
- $recurse_dirs->{$sitemap_path} = {
- files => Bugzilla::Install::Filesystem::CGI_WRITE
- | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE,
- dirs => Bugzilla::Install::Filesystem::DIR_CGI_WRITE
- | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE
- };
-
- # Create a htaccess file that allows the sitemap files to be served out
- $htaccess->{"$sitemap_path/.htaccess"} = {
- perms => Bugzilla::Install::Filesystem::WS_SERVE,
- contents => <<EOT
+ my ($self, $args) = @_;
+ my $create_dirs = $args->{'create_dirs'};
+ my $recurse_dirs = $args->{'recurse_dirs'};
+ my $htaccess = $args->{'htaccess'};
+
+ # Create the sitemap directory to store the index and sitemap files
+ my $sitemap_path = bz_locations->{'datadir'} . "/" . __PACKAGE__->NAME;
+
+ $create_dirs->{$sitemap_path} = Bugzilla::Install::Filesystem::DIR_CGI_WRITE
+ | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE;
+
+ $recurse_dirs->{$sitemap_path} = {
+ files => Bugzilla::Install::Filesystem::CGI_WRITE
+ | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE,
+ dirs => Bugzilla::Install::Filesystem::DIR_CGI_WRITE
+ | Bugzilla::Install::Filesystem::DIR_ALSO_WS_SERVE
+ };
+
+ # Create a htaccess file that allows the sitemap files to be served out
+ $htaccess->{"$sitemap_path/.htaccess"} = {
+ perms => Bugzilla::Install::Filesystem::WS_SERVE,
+ contents => <<EOT
# Allow access to sitemap files created by the SiteMapIndex extension
<FilesMatch ^sitemap.*\\.xml(.gz)?\$>
Allow from all
</FilesMatch>
Deny from all
EOT
- };
+ };
}
sub before_robots_txt {
- my ($self, $args) = @_;
- $args->{vars}{SITEMAP_URL} = Bugzilla->localconfig->{urlbase} . SITEMAP_URL;
+ my ($self, $args) = @_;
+ $args->{vars}{SITEMAP_URL} = Bugzilla->localconfig->{urlbase} . SITEMAP_URL;
}
__PACKAGE__->NAME;