]> git.wh0rd.org - tt-rss.git/commitdiff
Keep local cached images fresh if file exists.
authorJustAMacUser <donotreply@example.org>
Fri, 14 Aug 2015 23:49:41 +0000 (19:49 -0400)
committerJustAMacUser <donotreply@example.org>
Sun, 16 Aug 2015 04:33:33 +0000 (00:33 -0400)
Updates the cache_images() function to `touch` images if the file exists already. Some sites (e.g. news) re-use stock images and this change updates the local file's modified time every time the image is referenced in new articles. This should prevent the local file from being expired/deleted only to be re-cached later on.

include/rssfuncs.php

index a922516cd71b71633f4cc24b086b84a71d2fb5c7..7ea0bf0c88e3bfa5f811d529623e257203fa8b0b 100644 (file)
                                        if ($file_content && strlen($file_content) > _MIN_CACHE_IMAGE_SIZE) {
                                                file_put_contents($local_filename, $file_content);
                                        }
+                               } else {
+                                       touch($local_filename);
                                }
                        }
                }