Only touch on send for expirable cache files.

With d373b7b452 feed icon modification times get used for cache-busting, but 'Cache_Local' updates that
value on each send.  This change makes it so the modification time only gets updated on files in expirable caches, keeping the value
consistent between sends for files in non-expiring caches.

Also, marking 'Cache_Local::send_local_file()' private since it's unique to that adapter.
This commit is contained in:
wn_ 2022-12-20 02:03:46 +00:00
parent c6d21b3196
commit 8b129626cd
1 changed files with 4 additions and 2 deletions

View File

@ -124,10 +124,12 @@ class Cache_Local implements Cache_Adapter {
*
* @return bool|int false if the file doesn't exist (or unreadable) or isn't audio/video, true if a plugin handled, otherwise int of bytes sent
*/
function send_local_file(string $filename) {
private function send_local_file(string $filename) {
if (file_exists($filename)) {
if (is_writable($filename)) touch($filename);
if (is_writable($filename) && !$this->exists('.no-auto-expiry')) {
touch($filename);
}
$tmppluginhost = new PluginHost();