aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-09-18 00:28:09 +0800
committerByron Jones <glob@mozilla.com>2014-09-18 00:28:09 +0800
commit1bead98c517f658b17d42f2f79d8ce80317a7040 (patch)
tree16b569221a7d8b5124f92290f6be11122e6f2c14 /Bugzilla/Install
parent2288b4680c04ec00bff02179de926fdfbd896c79 (diff)
downloadbugs-1bead98c517f658b17d42f2f79d8ce80317a7040.tar
bugs-1bead98c517f658b17d42f2f79d8ce80317a7040.tar.gz
bugs-1bead98c517f658b17d42f2f79d8ce80317a7040.tar.bz2
bugs-1bead98c517f658b17d42f2f79d8ce80317a7040.tar.xz
bugs-1bead98c517f658b17d42f2f79d8ce80317a7040.zip
Bug 1064395: concatenate and slightly minify javascript files
r=dkl,a=glob
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r--Bugzilla/Install/Filesystem.pm25
1 files changed, 19 insertions, 6 deletions
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm
index 47b989f71..061ca53c7 100644
--- a/Bugzilla/Install/Filesystem.pm
+++ b/Bugzilla/Install/Filesystem.pm
@@ -31,6 +31,7 @@ use File::Path;
use File::Basename;
use File::Copy qw(move);
use File::Spec;
+use File::Slurp;
use IO::File;
use POSIX ();
@@ -367,7 +368,7 @@ EOT
"$assetsdir/.htaccess" => { perms => WS_SERVE, contents => <<EOT
# Allow access to .css files
-<FilesMatch \\.css\$>
+<FilesMatch \\.(css|js)\$>
Allow from all
</FilesMatch>
@@ -410,6 +411,7 @@ sub update_filesystem {
my $datadir = bz_locations->{'datadir'};
my $graphsdir = bz_locations->{'graphsdir'};
+ my $assetsdir = bz_locations->{'assetsdir'};
# If the graphs/ directory doesn't exist, we're upgrading from
# a version old enough that we need to update the $datadir/mining
# format.
@@ -450,6 +452,13 @@ sub update_filesystem {
_rename_file($oldparamsfile, "$datadir/$oldparamsfile");
}
+ # Remove old assets htaccess file to force recreation with correct values.
+ if (-e "$assetsdir/.htaccess") {
+ if (read_file("$assetsdir/.htaccess") =~ /<FilesMatch \\\.css\$>/) {
+ unlink("$assetsdir/.htaccess");
+ }
+ }
+
_create_files(%files);
if ($params->{index_html}) {
_create_files(%{$fs->{index_html}});
@@ -493,7 +502,7 @@ EOT
_remove_empty_css_files();
_convert_single_file_skins();
- _remove_dynamic_css_files();
+ _remove_dynamic_assets();
}
sub _remove_empty_css_files {
@@ -538,10 +547,14 @@ sub _convert_single_file_skins {
}
}
-# delete all automatically generated css files to force recreation at the next
-# request.
-sub _remove_dynamic_css_files {
- foreach my $file (glob(bz_locations()->{assetsdir} . '/*.css')) {
+# delete all automatically generated css/js files to force recreation at the
+# next request.
+sub _remove_dynamic_assets {
+ my @files = (
+ glob(bz_locations()->{assetsdir} . '/*.css'),
+ glob(bz_locations()->{assetsdir} . '/*.js'),
+ );
+ foreach my $file (@files) {
unlink($file);
}