Commit ccff2482 authored by Byron Jones's avatar Byron Jones

Bug 1016199: move skins/assets to data/assets

r=dkl, a=justdave
parent 60965ea0
...@@ -10,6 +10,5 @@ ...@@ -10,6 +10,5 @@
/localconfig /localconfig
/index.html /index.html
/skins/assets
/skins/contrib/Dusk/admin.css /skins/contrib/Dusk/admin.css
/skins/contrib/Dusk/bug.css /skins/contrib/Dusk/bug.css
...@@ -682,6 +682,7 @@ sub _bz_locations { ...@@ -682,6 +682,7 @@ sub _bz_locations {
# The script should really generate these graphs directly... # The script should really generate these graphs directly...
'webdotdir' => "$datadir/webdot", 'webdotdir' => "$datadir/webdot",
'extensionsdir' => "$libpath/extensions", 'extensionsdir' => "$libpath/extensions",
'assetsdir' => "$datadir/assets",
}; };
} }
......
...@@ -117,6 +117,7 @@ sub FILESYSTEM { ...@@ -117,6 +117,7 @@ sub FILESYSTEM {
my $localconfig = bz_locations()->{'localconfig'}; my $localconfig = bz_locations()->{'localconfig'};
my $template_cache = bz_locations()->{'template_cache'}; my $template_cache = bz_locations()->{'template_cache'};
my $graphsdir = bz_locations()->{'graphsdir'}; my $graphsdir = bz_locations()->{'graphsdir'};
my $assetsdir = bz_locations()->{'assetsdir'};
# We want to set the permissions the same for all localconfig files # We want to set the permissions the same for all localconfig files
# across all PROJECTs, so we do something special with $localconfig, # across all PROJECTs, so we do something special with $localconfig,
...@@ -199,7 +200,7 @@ sub FILESYSTEM { ...@@ -199,7 +200,7 @@ sub FILESYSTEM {
dirs => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE }, dirs => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE },
"$datadir/db" => { files => CGI_WRITE, "$datadir/db" => { files => CGI_WRITE,
dirs => DIR_CGI_WRITE }, dirs => DIR_CGI_WRITE },
"$skinsdir/assets" => { files => WS_SERVE, $assetsdir => { files => WS_SERVE,
dirs => DIR_CGI_OVERWRITE | DIR_ALSO_WS_SERVE }, dirs => DIR_CGI_OVERWRITE | DIR_ALSO_WS_SERVE },
# Readable directories # Readable directories
...@@ -260,7 +261,8 @@ sub FILESYSTEM { ...@@ -260,7 +261,8 @@ sub FILESYSTEM {
# The name of each directory that we should actually *create*, # The name of each directory that we should actually *create*,
# pointing at its default permissions. # pointing at its default permissions.
my %create_dirs = ( my %create_dirs = (
# This is DIR_ALSO_WS_SERVE because it contains $webdotdir. # This is DIR_ALSO_WS_SERVE because it contains $webdotdir and
# $assetsdir.
$datadir => DIR_CGI_OVERWRITE | DIR_ALSO_WS_SERVE, $datadir => DIR_CGI_OVERWRITE | DIR_ALSO_WS_SERVE,
# Directories that are read-only for cgi scripts # Directories that are read-only for cgi scripts
"$datadir/mining" => DIR_CGI_READ, "$datadir/mining" => DIR_CGI_READ,
...@@ -271,7 +273,7 @@ sub FILESYSTEM { ...@@ -271,7 +273,7 @@ sub FILESYSTEM {
$attachdir => DIR_CGI_WRITE, $attachdir => DIR_CGI_WRITE,
$graphsdir => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE, $graphsdir => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE,
$webdotdir => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE, $webdotdir => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE,
"$skinsdir/assets" => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE, $assetsdir => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE,
# Directories that contain content served directly by the web server. # Directories that contain content served directly by the web server.
"$skinsdir/custom" => DIR_WS_SERVE, "$skinsdir/custom" => DIR_WS_SERVE,
"$skinsdir/contrib" => DIR_WS_SERVE, "$skinsdir/contrib" => DIR_WS_SERVE,
...@@ -361,6 +363,18 @@ EOT ...@@ -361,6 +363,18 @@ EOT
Deny from all Deny from all
EOT EOT
}, },
"$assetsdir/.htaccess" => { perms => WS_SERVE, contents => <<EOT
# Allow access to .css files
<FilesMatch \\.css\$>
Allow from all
</FilesMatch>
# And no directory listings, either.
Deny from all
EOT
},
); );
Bugzilla::Hook::process('install_filesystem', { Bugzilla::Hook::process('install_filesystem', {
...@@ -526,9 +540,18 @@ sub _convert_single_file_skins { ...@@ -526,9 +540,18 @@ sub _convert_single_file_skins {
# delete all automatically generated css files to force recreation at the next # delete all automatically generated css files to force recreation at the next
# request. # request.
sub _remove_dynamic_css_files { sub _remove_dynamic_css_files {
foreach my $file (glob(bz_locations()->{skinsdir} . '/assets/*.css')) { foreach my $file (glob(bz_locations()->{assetsdir} . '/*.css')) {
unlink($file); unlink($file);
} }
# remove old skins/assets directory
my $old_path = bz_locations()->{skinsdir} . '/assets';
if (-d $old_path) {
foreach my $file (glob("$old_path/*.css")) {
unlink($file);
}
rmdir($old_path);
}
} }
sub create_htaccess { sub create_htaccess {
......
...@@ -499,13 +499,13 @@ sub _concatenate_css { ...@@ -499,13 +499,13 @@ sub _concatenate_css {
} @sources; } @sources;
my $cgi_path = bz_locations()->{cgi_path}; my $cgi_path = bz_locations()->{cgi_path};
my $skins_path = bz_locations()->{skinsdir}; my $skins_path = bz_locations()->{assetsdir};
# build minified files # build minified files
my @minified; my @minified;
foreach my $source (@sources) { foreach my $source (@sources) {
next unless -e "$cgi_path/$files{$source}"; next unless -e "$cgi_path/$files{$source}";
my $file = $skins_path . '/assets/' . md5_hex($source) . '.css'; my $file = $skins_path . '/' . md5_hex($source) . '.css';
if (!-e $file) { if (!-e $file) {
my $content = read_file("$cgi_path/$files{$source}"); my $content = read_file("$cgi_path/$files{$source}");
...@@ -523,7 +523,7 @@ sub _concatenate_css { ...@@ -523,7 +523,7 @@ sub _concatenate_css {
} }
# concat files # concat files
my $file = $skins_path . '/assets/' . md5_hex(join(' ', @sources)) . '.css'; my $file = $skins_path . '/' . md5_hex(join(' ', @sources)) . '.css';
if (!-e $file) { if (!-e $file) {
my $content = ''; my $content = '';
foreach my $source (@minified) { foreach my $source (@minified) {
......
There are four directories here, standard/, custom/, contrib/, and assets/. There are three directories here, standard/, custom/, and contrib/.
standard/ holds the standard stylesheets. These are used no matter what skin standard/ holds the standard stylesheets. These are used no matter what skin
the user selects. If the user selects the "Classic" skin, then *only* the the user selects. If the user selects the "Classic" skin, then *only* the
...@@ -16,6 +16,3 @@ if you want to override some CSS in skins/standard/global.css, then you should ...@@ -16,6 +16,3 @@ if you want to override some CSS in skins/standard/global.css, then you should
create a file called "global.css" in custom/ and put some CSS in it. The CSS create a file called "global.css" in custom/ and put some CSS in it. The CSS
you put into files in custom/ will be used *in addition* to the CSS in you put into files in custom/ will be used *in addition* to the CSS in
skins/standard/ or the CSS in skins/contrib/. It will apply to every skin. skins/standard/ or the CSS in skins/contrib/. It will apply to every skin.
assets/ holds the minified and concatenated files which are created by
checksetup.pl and Bugzilla::Template. Do not edit the files in this directory.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment