diff options
Diffstat (limited to 'engine/handlers')
-rw-r--r-- | engine/handlers/cache_handler.php | 21 | ||||
-rw-r--r-- | engine/handlers/export_handler.php | 6 |
2 files changed, 17 insertions, 10 deletions
diff --git a/engine/handlers/cache_handler.php b/engine/handlers/cache_handler.php index 94a0e64e9..b332ec379 100644 --- a/engine/handlers/cache_handler.php +++ b/engine/handlers/cache_handler.php @@ -60,26 +60,31 @@ preg_match($regex, $request, $matches); $type = $matches[1]; $viewtype = $matches[2]; $view = $matches[3]; +$ts = $matches[4]; + +// If is the same ETag, content didn't changed. +$etag = $ts; +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { + header("HTTP/1.1 304 Not Modified"); + exit; +} switch ($type) { case 'css': header("Content-type: text/css", true); - header('Expires: ' . date('r', strtotime("+6 months")), true); - header("Pragma: public", true); - header("Cache-Control: public", true); - $view = "css/$view"; break; case 'js': header('Content-type: text/javascript', true); - header('Expires: ' . date('r', strtotime("+6 months")), true); - header("Pragma: public", true); - header("Cache-Control: public", true); - $view = "js/$view"; break; } +header('Expires: ' . date('r', strtotime("+6 months")), true); +header("Pragma: public", true); +header("Cache-Control: public", true); +header("ETag: $etag"); + $filename = $dataroot . 'views_simplecache/' . md5($viewtype . $view); if (file_exists($filename)) { diff --git a/engine/handlers/export_handler.php b/engine/handlers/export_handler.php index b91a037e8..aa5214c23 100644 --- a/engine/handlers/export_handler.php +++ b/engine/handlers/export_handler.php @@ -72,8 +72,10 @@ if (($guid != "") && ($type == "") && ($id_or_name == "")) { $r = get_relationship($id_or_name); break; case 'volatile' : - $m = elgg_trigger_plugin_hook('volatile', 'metadata', - array('guid' => $guid, 'varname' => $id_or_name)); + $m = elgg_trigger_plugin_hook('volatile', 'metadata', array( + 'guid' => $guid, + 'varname' => $id_or_name, + )); break; default : |