summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries/Theme_View.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-06-28 15:30:13 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-06-28 15:30:13 -0700
commitbf26ca727e615e61a8f61a2bbf1a83572cfa5c20 (patch)
tree91d82e6b5fa26bea3f9180b4d89b93c1e0520853 /modules/gallery/libraries/Theme_View.php
parent7a3310e91b50f37b09a1c9d10173409244015653 (diff)
Change the combined javascript to use the new caching functionality and respect the HTTP_IF_MODIFIED_SINCE header request.
Diffstat (limited to 'modules/gallery/libraries/Theme_View.php')
-rw-r--r--modules/gallery/libraries/Theme_View.php11
1 files changed, 7 insertions, 4 deletions
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 "<script type=\"text/javascript\" src=\"" . url::site("javascript/combined/$key") .
"\"></script>";
}