Move DateTime::RFC2822 to DateTimeInterface::2822

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/27635/head
Christoph Wurst 4 years ago
parent 770881d5d6
commit 6d5cfe0c66
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
  1. 2
      apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php
  2. 2
      lib/private/AppFramework/Middleware/NotModifiedMiddleware.php
  3. 2
      lib/private/Files/ObjectStore/S3Signature.php
  4. 4
      lib/public/AppFramework/Http/Response.php
  5. 6
      tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php

@ -76,7 +76,7 @@ class AppleProvisioningNode implements INode, IProperties {
return [
'{DAV:}getcontentlength' => 42,
'{DAV:}getlastmodified' => $datetime->format(\DateTime::RFC2822),
'{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822),
];
}

@ -46,7 +46,7 @@ class NotModifiedMiddleware extends Middleware {
}
$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;
}

@ -129,7 +129,7 @@ class S3Signature implements SignatureInterface {
) {
$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

@ -115,7 +115,7 @@ class Response {
$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']);
@ -244,7 +244,7 @@ class Response {
if ($this->lastModified) {
$mergeWith['Last-Modified'] =
$this->lastModified->format(\DateTime::RFC2822);
$this->lastModified->format(\DateTimeInterface::RFC2822);
}
$this->headers['Content-Security-Policy'] = $this->getContentSecurityPolicy()->buildPolicy();

@ -61,13 +61,13 @@ class NotModifiedMiddlewareTest extends \Test\TestCase {
[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],
];
}

Loading…
Cancel
Save