From: Jamie C. <jca...@we...> - 2009-02-17 17:38:18
|
On 17/Feb/2009 01:37 David Harrison wrote .. > On 17/02/2009, at 7:56 AM, Jamie Cameron wrote: > > > Assuming you just want to cache all images and .js files, you could > > build a full list with code like : > > > > open(FIND, "find $root_directory -type f -name '*.{gif,png,jpg,js}' > > |"); > > while($file = <FIND>) { > > chop($file); > > $file =~ s/^\Q$root_directory\E//; > > $file = $gconfig{'webprefix'}.$file; > > $manifest .= "{ \"url\" : \"$file\" },"; > > } > > print $manifest; > > > > Does that help? > > > Thanks Jamie, > Based on the snippet you provided I've built a far more flexible > manifest generation script. > I chose to use File::Find rather than the command line 'find' tool as > it seemed to keep me more platform neutral. > > Now rather than caching just a couple of hundred files all of a Webmin > installs static content (excluding other themes) is cached. > For my test Webmin installation this turned out to be 2,400-odd files. Great! Shouldn't the browser be caching these static files after they are fetched once though? Or does gears pre-cache them all? > I've had to do a bit of a quick hack job on the init_config function > in order to get around the referrer check. > This is due to Gears operating as a separate process and not including > any referrer details when making the manifest request. There is a supported way of skipping refer checking in this case .. just set $trust_unknown_referers = 1; before calling init_config. - Jamie |