diff options
author | Andrew Dolgov <[email protected]> | 2022-12-19 21:36:50 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-12-19 21:36:50 +0300 |
commit | d373b7b452c6d64b47180940ed88c99c21bd9bc3 (patch) | |
tree | 08024adea61fcee2f646554a349ea90b30a150b4 /classes/pref | |
parent | 20d6aaa9ab976d3e044fbd7ad2b1167260cc213c (diff) |
* bring back cache-busting for feed icons based on timestamp
* DiskCache: use singleton pattern to create less cache object instances
* DiskCache: implement ETag
Diffstat (limited to 'classes/pref')
-rwxr-xr-x | classes/pref/feeds.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 067b8225e..a9ae91979 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -455,7 +455,7 @@ class Pref_Feeds extends Handler_Protected { function removeIcon(): void { $feed_id = (int) $_REQUEST["feed_id"]; - $cache = new DiskCache('feed-icons'); + $cache = DiskCache::instance('feed-icons'); $feed = ORM::for_table('ttrss_feeds') ->where('owner_uid', $_SESSION['uid']) @@ -487,7 +487,7 @@ class Pref_Feeds extends Handler_Protected { if ($feed && $tmp_file && move_uploaded_file($_FILES['icon_file']['tmp_name'], $tmp_file)) { if (filesize($tmp_file) < Config::get(Config::MAX_FAVICON_FILE_SIZE)) { - $cache = new DiskCache('feed-icons'); + $cache = DiskCache::instance('feed-icons'); if ($cache->put((string)$feed_id, file_get_contents($tmp_file))) { @@ -514,7 +514,8 @@ class Pref_Feeds extends Handler_Protected { if (file_exists($tmp_file)) unlink($tmp_file); - print json_encode(['rc' => $rc, 'icon_url' => Feeds::_get_icon($feed_id)]); + print json_encode(['rc' => $rc, 'icon_url' => + Feeds::_get_icon($feed_id) . "?ts=" . time() ]); } function editfeed(): void { @@ -1188,7 +1189,7 @@ class Pref_Feeds extends Handler_Protected { $pdo->commit(); - $favicon_cache = new DiskCache('feed-icons'); + $favicon_cache = DiskCache::instance('feed-icons'); if ($favicon_cache->exists((string)$id)) $favicon_cache->remove((string)$id); |