$self->plugin('Bugzilla::App::Plugin::Helpers');
$self->plugin('Bugzilla::App::Plugin::OAuth2');
- push @{ $self->commands->namespaces }, 'Bugzilla::App::Command';
+ push @{$self->commands->namespaces}, 'Bugzilla::App::Command';
$self->sessions->cookie_name('bugzilla');
$self->hook(
after_static => sub {
my ($c) = @_;
- $c->res->headers->cache_control('public, max-age=31536000, immutable');
+ my $version = $c->stash->{static_file_version};
+ if ($version && $version > Bugzilla->VERSION) {
+ $c->res->headers->cache_control('no-cache, no-store');
+ }
+ else {
+ $c->res->headers->cache_control('public, max-age=31536000, immutable');
+ }
}
);
}
use Bugzilla::Constants qw(bz_locations);
my $LEGACY_RE = qr{
- ^ (?:static/v[0-9]+\.[0-9]+/) ?
- ( (?:extensions/[^/]+/web|(?:image|skin|j|graph)s)/.+)
+ ^ (?:static/v(?<version>[0-9]+\.[0-9]+)/) ?
+ (?<file>(?:extensions/[^/]+/web|(?:image|skin|j|graph)s)/.+)
$
}xs;
-sub file {
- my ($self, $rel) = @_;
+sub serve {
+ my ($self, $c, $rel) = @_;
- if (my ($legacy_rel) = $rel =~ $LEGACY_RE) {
+ if ($rel =~ $LEGACY_RE) {
local $self->{paths} = [bz_locations->{cgi_path}];
- return $self->SUPER::file($legacy_rel);
+ my $version = $+{version};
+ my $file = $+{file};
+ $c->stash->{static_file_version} = $version;
+ return $self->SUPER::serve($c, $file);
}
else {
- return $self->SUPER::file($rel);
+ return $self->SUPER::serve($c, $rel);
}
}