diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-31 15:27:26 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-06-04 09:48:54 +0300 |
commit | e5cc8be9d5f8899417aa0716b8b29c596417af61 (patch) | |
tree | 6c3fad6b8b9fcdf396417b0cd2020544a01c0835 | |
parent | a34495933e83c4c850308e3448a16160162eb65a (diff) |
Fix usage
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r-- | apps/theming/lib/Controller/IconController.php | 15 | ||||
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 14 | ||||
-rw-r--r-- | apps/theming/tests/Controller/IconControllerTest.php | 25 | ||||
-rw-r--r-- | apps/theming/tests/Controller/ThemingControllerTest.php | 26 | ||||
-rw-r--r-- | core/Controller/AvatarController.php | 8 | ||||
-rw-r--r-- | core/Controller/PreviewController.php | 10 |
6 files changed, 0 insertions, 98 deletions
diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index 61df7b0b353..13f385e0bd1 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -101,11 +101,6 @@ class IconController extends Controller { if ($iconFile !== false) { $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); $response->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $response->addHeader('Pragma', 'cache'); return $response; } @@ -146,11 +141,6 @@ class IconController extends Controller { $response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); } $response->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $response->addHeader('Pragma', 'cache'); return $response; } @@ -187,11 +177,6 @@ class IconController extends Controller { $response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/png']); } $response->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $response->addHeader('Pragma', 'cache'); return $response; } } diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index a834bb1c5ab..c50e8a18460 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -368,11 +368,6 @@ class ThemingController extends Controller { $response = new FileDisplayResponse($file); $response->cacheFor(3600); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $response->addHeader('Pragma', 'cache'); $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', '')); $response->addHeader('Content-Disposition', 'attachment; filename="' . $key . '"'); return $response; @@ -403,11 +398,6 @@ class ThemingController extends Controller { $cssFile = $this->scssCacher->getCachedCSS('theming', 'theming.css'); $response = new FileDisplayResponse($cssFile, Http::STATUS_OK, ['Content-Type' => 'text/css']); $response->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC1123)); - $response->addHeader('Pragma', 'cache'); return $response; } catch (NotFoundException $e) { return new NotFoundResponse(); @@ -435,8 +425,6 @@ class ThemingController extends Controller { }; })();'; $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript'); - $response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime())); - $response->addHeader('Pragma', 'cache'); $response->cacheFor(3600); return $response; } @@ -470,8 +458,6 @@ class ThemingController extends Controller { 'display' => 'standalone' ]; $response = new Http\JSONResponse($responseJS); - $response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime())); - $response->addHeader('Pragma', 'cache'); $response->cacheFor(3600); return $response; } diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index 6539c6e0209..f509005d32c 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -102,11 +102,6 @@ class IconControllerTest extends TestCase { ->willReturn($file); $expected = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); $expected->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $expected->addHeader('Pragma', 'cache'); $this->assertEquals($expected, $this->iconController->getThemedIcon('core', 'filetypes/folder.svg')); } @@ -139,11 +134,6 @@ class IconControllerTest extends TestCase { $expected = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); $expected->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $expected->addHeader('Pragma', 'cache'); $this->assertEquals($expected, $this->iconController->getFavicon()); } @@ -162,11 +152,6 @@ class IconControllerTest extends TestCase { ->willReturn(file_get_contents($fallbackLogo)); $expected = new DataDisplayResponse(file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); $expected->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $expected->addHeader('Pragma', 'cache'); $this->assertEquals($expected, $this->iconController->getFavicon()); } @@ -196,11 +181,6 @@ class IconControllerTest extends TestCase { $expected = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'image/png']); $expected->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $expected->addHeader('Pragma', 'cache'); $this->assertEquals($expected, $this->iconController->getTouchIcon()); } @@ -219,11 +199,6 @@ class IconControllerTest extends TestCase { ->willReturn(file_get_contents($fallbackLogo)); $expected = new DataDisplayResponse(file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/png']); $expected->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $expected->addHeader('Pragma', 'cache'); $this->assertEquals($expected, $this->iconController->getTouchIcon()); } diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index cd50061c59a..4a2b780076c 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -695,11 +695,6 @@ class ThemingControllerTest extends TestCase { @$expected = new Http\FileDisplayResponse($file); $expected->cacheFor(3600); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $expected->addHeader('Pragma', 'cache'); $expected->addHeader('Content-Type', 'text/svg'); $expected->addHeader('Content-Disposition', 'attachment; filename="logo"'); @$this->assertEquals($expected, $this->themingController->getImage('logo')); @@ -728,11 +723,6 @@ class ThemingControllerTest extends TestCase { @$expected = new Http\FileDisplayResponse($file); $expected->cacheFor(3600); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $expected->addHeader('Pragma', 'cache'); $expected->addHeader('Content-Type', 'image/png'); $expected->addHeader('Content-Disposition', 'attachment; filename="background"'); @$this->assertEquals($expected, $this->themingController->getImage('background')); @@ -749,11 +739,6 @@ class ThemingControllerTest extends TestCase { $response = new Http\FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'text/css']); $response->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC1123)); - $response->addHeader('Pragma', 'cache'); $actual = $this->themingController->getStylesheet(); $this->assertEquals($response, $actual); @@ -782,11 +767,6 @@ class ThemingControllerTest extends TestCase { $response = new Http\FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'text/css']); $response->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC1123)); - $response->addHeader('Pragma', 'cache'); $actual = $this->themingController->getStylesheet(); $this->assertEquals($response, $actual); @@ -824,8 +804,6 @@ class ThemingControllerTest extends TestCase { }; })();'; $expected = new Http\DataDownloadResponse($expectedResponse, 'javascript', 'text/javascript'); - $expected->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime())); - $expected->addHeader('Pragma', 'cache'); $expected->cacheFor(3600); @$this->assertEquals($expected, $this->themingController->getJavascript()); } @@ -860,8 +838,6 @@ class ThemingControllerTest extends TestCase { }; })();'; $expected = new Http\DataDownloadResponse($expectedResponse, 'javascript', 'text/javascript'); - $expected->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime())); - $expected->addHeader('Pragma', 'cache'); $expected->cacheFor(3600); @$this->assertEquals($expected, $this->themingController->getJavascript()); } @@ -908,8 +884,6 @@ class ThemingControllerTest extends TestCase { ], 'display' => 'standalone' ]); - $response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime())); - $response->addHeader('Pragma', 'cache'); $response->cacheFor(3600); $this->assertEquals($response, $this->themingController->getManifest('core')); } diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 14709d65fed..11d81ab00b2 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -141,16 +141,8 @@ class AvatarController extends Controller { return $resp; } - // Let cache this! - $resp->addHeader('Pragma', 'public'); // Cache for 30 minutes $resp->cacheFor(1800); - - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT30M')); - $resp->addHeader('Expires', $expires->format(\DateTime::RFC1123)); - return $resp; } diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index e18487363a1..3dfc4872d01 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -174,17 +174,7 @@ class PreviewController extends Controller { try { $f = $this->preview->getPreview($node, $x, $y, !$a, $mode); $response = new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); - - // Let cache this! - $response->addHeader('Pragma', 'public'); - - // Cache previews for 24H $response->cacheFor(3600 * 24); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('P1D')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - return $response; } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); |