improved cache control for attachments
This commit is contained in:
parent
c4f18e49f4
commit
e9cb883001
@ -261,10 +261,26 @@ class Wiki extends Controller
|
|||||||
|
|
||||||
$mtime = @filemtime ($path);
|
$mtime = @filemtime ($path);
|
||||||
if ($mtime === FALSE) $mtime = time();
|
if ($mtime === FALSE) $mtime = time();
|
||||||
|
|
||||||
header ('Content-Type: ' . mime_content_type($path));
|
header ('Content-Type: ' . mime_content_type($path));
|
||||||
header ('Expires: ' . gmdate("D, d M Y H:i:s", time() + 60*60*24*30) . ' GMT'); // 30days
|
|
||||||
|
//header ('Expires: ' . gmdate("D, d M Y H:i:s", time() + 60*60*24*30) . ' GMT'); // 30days
|
||||||
|
//header ('Expires: -1');
|
||||||
|
//header ('Cache-Control: must-revalidate, private');
|
||||||
|
header ('Cache-Control: max-age=0');
|
||||||
|
$reqheaders = function_exists('apache_request_headers')? apache_request_headers(): array();
|
||||||
|
|
||||||
|
if (isset($reqheaders['If-Modified-Since']) &&
|
||||||
|
strtotime($reqheaders['If-Modified-Since']) >= $mtime)
|
||||||
|
{
|
||||||
|
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime).' GMT', true, 304);
|
||||||
|
flush ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
header ('Last-Modified: ' . gmdate("D, d M Y H:i:s", $mtime) . ' GMT');
|
header ('Last-Modified: ' . gmdate("D, d M Y H:i:s", $mtime) . ' GMT');
|
||||||
header ("Content-Disposition: filename={$name}");
|
header ("Content-Disposition: filename={$name}");
|
||||||
|
|
||||||
$len = @filesize($path);
|
$len = @filesize($path);
|
||||||
if ($len !== FALSE) header("Content-Length: {$len}");
|
if ($len !== FALSE) header("Content-Length: {$len}");
|
||||||
//header("Content-Transfer-Encoding: binary");
|
//header("Content-Transfer-Encoding: binary");
|
||||||
@ -281,6 +297,7 @@ class Wiki extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function _edit_wiki ($projectid, $name, $mode)
|
function _edit_wiki ($projectid, $name, $mode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user