|
|
@ -161,6 +161,10 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) { |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { |
|
|
|
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { |
|
|
|
$modified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_MODIFIED_SINCE']); |
|
|
|
$modified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_MODIFIED_SINCE']); |
|
|
|
|
|
|
|
if ($modified_since === FALSE) { |
|
|
|
|
|
|
|
return $return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
if ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) { |
|
|
|
if ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) { |
|
|
|
// Changed! |
|
|
|
// Changed! |
|
|
|
return $return; |
|
|
|
return $return; |
|
|
@ -169,8 +173,13 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) { |
|
|
|
$return = 304; |
|
|
|
$return = 304; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if ($return === 200 && isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) { |
|
|
|
if ($return === 200 && isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) { |
|
|
|
$unmodified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_UNMODIFIED_SINCE']); |
|
|
|
$unmodified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_UNMODIFIED_SINCE']); |
|
|
|
|
|
|
|
if ($unmodified_since === FALSE) { |
|
|
|
|
|
|
|
return $return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
if ($datastream->createdDate->getTimestamp() !== $unmodified_since->getTimestamp()) { |
|
|
|
if ($datastream->createdDate->getTimestamp() !== $unmodified_since->getTimestamp()) { |
|
|
|
// Changed! |
|
|
|
// Changed! |
|
|
|
$return = 412; |
|
|
|
$return = 412; |
|
|
@ -179,6 +188,7 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) { |
|
|
|
return $return; |
|
|
|
return $return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Only consider Etags we have provided. |
|
|
|
// Only consider Etags we have provided. |
|
|
|
if (isset($datastream->checksum)) { |
|
|
|
if (isset($datastream->checksum)) { |
|
|
|