From 55eeb8336fcfd2d2c0542e85de9da100bce1c338 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 30 Dec 2009 09:55:28 -0800 Subject: Change the file proxy to use the expires helper to manage content expiration. Fixes ticket #953. --- modules/gallery/controllers/file_proxy.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 65c0cb50..72c4e104 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -99,6 +99,12 @@ class File_Proxy_Controller extends Controller { throw new Kohana_404_Exception(); } + // Check that the content hasn't expired or it wasn't changed since cached + if (($last_modified = expires::get()) !== false && + $item->updated < $last_modified) { + expires::check(2592000); + } + // Don't try to load a directory if ($type == "albums" && $item->is_album()) { throw new Kohana_404_Exception(); @@ -111,6 +117,8 @@ class File_Proxy_Controller extends Controller { // We don't need to save the session for this request Session::abort_save(); + expires::set(2592000); // 30 days + // Dump out the image. If the item is a movie, then its thumbnail will be a JPG. if ($item->is_movie() && $type != "albums") { header("Content-type: image/jpeg"); -- cgit v1.2.3