From bf26ca727e615e61a8f61a2bbf1a83572cfa5c20 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 28 Jun 2009 15:30:13 -0700 Subject: Change the combined javascript to use the new caching functionality and respect the HTTP_IF_MODIFIED_SINCE header request. --- modules/gallery/libraries/Theme_View.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 167f8a8d..f55cb55a 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -188,18 +188,21 @@ class Theme_View_Core extends View { } $key = md5($key); - $file = "tmp/CombinedJavascript_$key"; - if (!file_exists(VARPATH . $file)) { + $contents = Cache::instance()->get($key); + if (empty($contents)) { $contents = ''; foreach ($links as $link) { $contents .= file_get_contents($link); } - file_put_contents(VARPATH . $file, $contents); + Cache::instance()->set($key, $contents, array("javascript"), 84600); if (function_exists("gzencode")) { - file_put_contents(VARPATH . "{$file}_gzip", gzencode($contents, 9, FORCE_GZIP)); + Cache::instance()->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP), + array("javascript", "gzip"), 84600); } + Cache::instance()->set("{$key}_modified", time(), array("javascript", "modified"), 84600); } + // Handcraft the script link because html::script will add a .js extenstion return ""; } -- cgit v1.2.3