Figure out where the headers of an image file are being written

Re: Figure out where the headers of an image file are being written

by Benjamin Ellis -
Number of replies: 2
Picture of Particularly helpful Moodlers
Hi,

The usual penultimate for that URL would usually be a function ?????_pluginfile() in the component's lib.php but since this is a core component, the function is in the lib/filelib.php in the file_pluginfile() function.   A call is made to send_stored_file() function where the 2nd parameter is the 'file time to live' variable.  However, it is generally accepted that it is not really a good idea to change the core code.  I think you can override $CFG->filelifetime variable but only if the 2nd parameter passed to send_stored_file() is null.  Unfortunately, the blog files are set with a 10 minute cache lifetime. 

Hope that helps
Average of ratings: Useful (1)
In reply to Benjamin Ellis

Re: Figure out where the headers of an image file are being written

by Jacket Racket -
That was very helpful. Thank you for providing a larger picture of how things are working.
"the blog files are set with a 10 minute cache lifetime" can you kindly point out where this value of 10 minutes is being set in the code?
In reply to Jacket Racket

Re: Figure out where the headers of an image file are being written

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
hi,

It's in the file_pluginfile() function in lib/filelib.php - see http://xref-diff.mukudu-dev.net/moodle39/lib/filelib.php.source.html#l4289.  But like I said not usually a good idea to core hack but if you must, you might want to check that the file is an image file and set the headers as required just for those files.