Browse Source

Merge pull request #705 from jonathangreen/warning

Prevent Warning [Release Pull]
pull/708/head
Diego Pino Navarro 7 years ago committed by GitHub
parent
commit
964804738d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      includes/datastream.inc

24
includes/datastream.inc

@ -161,22 +161,32 @@ 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 ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) { if ($modified_since === FALSE) {
// Changed!
return $return; return $return;
} }
else { else {
$return = 304; if ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) {
// Changed!
return $return;
}
else {
$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 ($datastream->createdDate->getTimestamp() !== $unmodified_since->getTimestamp()) { if ($unmodified_since === FALSE) {
// Changed! return $return;
$return = 412;
} }
else { else {
return $return; if ($datastream->createdDate->getTimestamp() !== $unmodified_since->getTimestamp()) {
// Changed!
$return = 412;
}
else {
return $return;
}
} }
} }

Loading…
Cancel
Save