Browse Source

Coding standards.

pull/393/head
Adam Vessey 11 years ago
parent
commit
64c90936d9
  1. 8
      includes/datastream.inc

8
includes/datastream.inc

@ -72,7 +72,8 @@ function islandora_view_datastream(AbstractDatastream $datastream, $download = F
drupal_page_is_cacheable(FALSE); drupal_page_is_cacheable(FALSE);
// Try not to load the file into PHP memory! // Try not to load the file into PHP memory!
// Close and flush ALL the output buffers! // Close and flush ALL the output buffers!
while(@ob_end_flush()) {}; while (@ob_end_flush()) {
};
// New content needed. // New content needed.
if ($cache_check === 200) { if ($cache_check === 200) {
@ -99,7 +100,7 @@ function islandora_parse_http_match_headers($header_value) {
/** /**
* Validate cache headers. * Validate cache headers.
* *
* @param AbstractDatastream $datastrea * @param AbstractDatastream $datastream
* *
* @return int * @return int
* An integer representing the HTTP response code. One of: * An integer representing the HTTP response code. One of:
@ -174,6 +175,7 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) {
* The datastream being viewed/downloaded. * The datastream being viewed/downloaded.
*/ */
function islandora_view_datastream_set_cache_headers(AbstractDatastream $datastream) { function islandora_view_datastream_set_cache_headers(AbstractDatastream $datastream) {
// Force cache revalidation.
header('Expires: Sun, 19 Nov 1978 05:00:00 GMT'); header('Expires: Sun, 19 Nov 1978 05:00:00 GMT');
$cache_control = array(); $cache_control = array();
if ($datastream->parent->repository->api->connection->username == 'anonymous') { if ($datastream->parent->repository->api->connection->username == 'anonymous') {
@ -185,7 +187,7 @@ function islandora_view_datastream_set_cache_headers(AbstractDatastream $datastr
$cache_control[] = 'must-revalidate'; $cache_control[] = 'must-revalidate';
$cache_control[] = 'max-age=0'; $cache_control[] = 'max-age=0';
header('Cache-Control: ' . implode(', ', $cache_control)); header('Cache-Control: ' . implode(', ', $cache_control));
header('Last-Modified: '. $datastream->createdDate->format('D, d M Y H:i:s \G\M\T')); header('Last-Modified: ' . $datastream->createdDate->format('D, d M Y H:i:s \G\M\T'));
if (isset($datastream->checksum)) { if (isset($datastream->checksum)) {
header("Etag: \"{$datastream->checksum}\""); header("Etag: \"{$datastream->checksum}\"");
} }

Loading…
Cancel
Save