Thanks for the tip! I just wrote a little script that does just that,
and it appears to work swimmingly. All the files are owned by my user
account, and bugzilla is set to run as my user group. The static files
(.js, .css, .png, .gif, .html, and .tmpl) are all o+r and directories
containing them are set o+rx. I also had to change all .htaccess files
to o+r. The script has to be run after checkconfig.pl, as
checkconfig.pl resets the ownership back.
It would be slick if checkconfig.pl could do this all by itself. I could add a
patch to do that if desired (my little script is in bash, maybe it would be
better to rewrite it in perl to fit in with the rest of bugzilla)? With the
increasing affordability of shared hosting combined with suexec, it
seems like this would open up bugzilla to a much larger audience (maybe
could even get it included in fantastico or other similar tools).
Here's the script. I'll offer it as GPL for now, but if it would be
useful to MPL it, I'd be happy to do so:
#!/bin/bash
function checkdir() {
cd $1
local hasstatic=0
for i in *; do
ext=${i##*.}
nonext=${i%.*}
if [ "$nonext" == "$ext" ]; then ext=""; fi
if [ "$ext" == "js" ] || [ "$ext" == "css" ]\
|| [ "$ext" == "gif" ]\
|| [ "$ext" == "png" ] || [ "$ext" == "html" ]\
|| [ "$ext" == "tmpl" ]; then
hasstatic=1
echo "o+r $i"
chmod o+r $i
fi
if [ -d "$i" ] && [ "$i" != "$1" ] && [ "$i" != "../" ]; then
checkdir $i;
r=$?
if [ $r == 1 ]; then
hasstatic=1
fi
fi
done;
if [ $hasstatic == 1 ]; then
cdir=`pwd`
echo "o+rx $cdir"
chmod o+rx $cdir
fi
cd ..
}
for i in `find . -name .htaccess`; do
echo "o+r $i";
chmod o+r $i;
done
checkdir $1;
Thanks again for the tip,
Alen
Here's an updated version of the script that is a bit safer (it won't
'escape' from the current directory if you forget to add a pathname arg
when invoking, and it exits immediately if you do forget that arg).
Use this instead:
#!/bin/bash
parent=$1
if [ ! -d "$parent" ]; then
echo "need to provide a path to start in"
exit
fi
function checkdir() {
pushd $1
popd
return $hasstatic
}
for i in `find . -name .htaccess`; do
echo "o+r $i";
chmod o+r $i;
done
checkdir $parent;