Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Move DateTime::RFC2822 to DateTimeInterface::2822
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Jun 23, 2021
commit 6d5cfe0c66f7010d552f0aa234a13c2e91a933bd
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getProperties($properties) {

return [
'{DAV:}getcontentlength' => 42,
'{DAV:}getlastmodified' => $datetime->format(\DateTime::RFC2822),
'{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function afterController($controller, $methodName, Response $response) {
}

$modifiedSinceHeader = $this->request->getHeader('IF_MODIFIED_SINCE');
if ($modifiedSinceHeader !== '' && $response->getLastModified() !== null && trim($modifiedSinceHeader) === $response->getLastModified()->format(\DateTime::RFC2822)) {
if ($modifiedSinceHeader !== '' && $response->getLastModified() !== null && trim($modifiedSinceHeader) === $response->getLastModified()->format(\DateTimeInterface::RFC2822)) {
$response->setStatus(Http::STATUS_NOT_MODIFIED);
return $response;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/ObjectStore/S3Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private function prepareRequest(
) {
$modify = [
'remove_headers' => ['X-Amz-Date'],
'set_headers' => ['Date' => gmdate(\DateTime::RFC2822)]
'set_headers' => ['Date' => gmdate(\DateTimeInterface::RFC2822)]
];

// Add the security token header if one is being used by the credentials
Expand Down
4 changes: 2 additions & 2 deletions lib/public/AppFramework/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function cacheFor(int $cacheSeconds, bool $public = false) {
$time = \OC::$server->query(ITimeFactory::class);
$expires->setTimestamp($time->getTime());
$expires->add(new \DateInterval('PT'.$cacheSeconds.'S'));
$this->addHeader('Expires', $expires->format(\DateTime::RFC2822));
$this->addHeader('Expires', $expires->format(\DateTimeInterface::RFC2822));
} else {
$this->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
unset($this->headers['Expires'], $this->headers['Pragma']);
Expand Down Expand Up @@ -244,7 +244,7 @@ public function getHeaders() {

if ($this->lastModified) {
$mergeWith['Last-Modified'] =
$this->lastModified->format(\DateTime::RFC2822);
$this->lastModified->format(\DateTimeInterface::RFC2822);
}

$this->headers['Content-Security-Policy'] = $this->getContentSecurityPolicy()->buildPolicy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public function dataModified(): array {
[null, '"etag"', null, '', false],
['etag', '"etag"', null, '', true],

[null, '', $now, $now->format(\DateTime::RFC2822), true],
[null, '', $now, $now->format(\DateTimeInterface::RFC2822), true],
[null, '', $now, $now->format(\DateTimeInterface::ATOM), false],
[null, '', null, $now->format(\DateTime::RFC2822), false],
[null, '', null, $now->format(\DateTimeInterface::RFC2822), false],
[null, '', $now, '', false],

['etag', '"etag"', $now, $now->format(\DateTimeInterface::ATOM), true],
['etag', '"etag"', $now, $now->format(\DateTime::RFC2822), true],
['etag', '"etag"', $now, $now->format(\DateTimeInterface::RFC2822), true],
];
}

Expand Down