Hi, and thank you for this module :)! I'm running it succesfully on many sites, it's been very usefull.
Yesterday I downloaded the 1.0 version, since I noticed support for private file systems was added recently. My intra site was using public file system, but I converted it to private. I created a separate "public" -folder for advagg.
I did encounter some problems during the process, which I was able to fix eventually. But I also noticed a small but annoying bug in advagg.module.
Basically I got this error for all or most of my files:
Warning: filesize() [function.filesize]: stat failed for somefolder/somefile.jpg in advagg_file_download() (line 3275 of /my_path/sites/default/modules/contrib/advagg/advagg.module).
This continued on pretty much all pages with attachments.
I looked at the function (which I think was added recently?):
/**
* Implementation of hook_file_download().
*
* Return the correct headers for advagg bundles.
*/
function advagg_file_download($file, $type = '') {
if (strpos($file, '/advagg_') !== 0) {
$return = array(
'Content-Length: ' . filesize($file),
'Cache-Control: ' . 'max-age=31556926, public',
);
...
.. and the culprit was clear: "strpos($file, '/advagg_') !== 0" is always true (..except, you know when). Meaning filesize() was run for all files, even those that were located elsewhere.
What you must have intented was:
... if (strpos($file, '/advagg_') !== false) { ...
Right?
I changed the "0" to "false" on my site, and my errors disappeared.
Sorry for the lack of patch, but this oneliner is probably easier to fix by hand :)
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | advagg-1193176-1.patch | 953 bytes | mikeytown2 |
Comments
Comment #1
mikeytown2 commentedcommitted this code, let me know if this doesn't fix it for you.
Comment #2
gg4 commentedEchoing the :: Thanks :: and subscribing.
Comment #3
bibo commentedThanks mikeytown2, works well :)
Comment #4
Peter Bowey commentedRefer #1
Working as expected, many thanks!
Comment #5
aschiwi commentedWorked for me too, thanks!