[TASK] htaccess: create if any of the sendCacheHeader settings are true
authorBenjamin Franzke <bfr@qbus.de>
Sat, 26 Dec 2015 08:26:02 +0000 (09:26 +0100)
committerTim Lochm├╝ller <tim@fruit-lab.de>
Tue, 29 Dec 2015 09:12:38 +0000 (10:12 +0100)
It may be desired to use the redirect after cache timeout feature
without sending expire headers.

Classes/Cache/StaticFileBackend.php
Resources/Private/Templates/Htaccess.html

index 7954f06..01f9e9f 100644 (file)
@@ -88,7 +88,7 @@ class StaticFileBackend extends AbstractBackend
      */
     protected function writeHtAccessFile($originalFileName, $lifetime)
     {
-        if ($this->configuration->get('sendCacheControlHeader')) {
+        if ($this->configuration->get('sendCacheControlHeader') || $this->configuration->get('sendCacheControlHeaderRedirectAfterCacheTimeout')) {
             $fileName = PathUtility::pathinfo($originalFileName, PATHINFO_DIRNAME) . '/.htaccess';
             $accessTimeout = $this->configuration->get('htaccessTimeout');
             $lifetime = $accessTimeout ? $accessTimeout : $this->getRealLifetime($lifetime);
@@ -100,6 +100,7 @@ class StaticFileBackend extends AbstractBackend
                 'mode' => $accessTimeout ? 'A' : 'M',
                 'lifetime' => $lifetime,
                 'expires' => time() + $lifetime,
+                'sendCacheControlHeader' => (bool)$this->configuration->get('sendCacheControlHeader'),
                 'sendCacheControlHeaderRedirectAfterCacheTimeout' => (bool)$this->configuration->get('sendCacheControlHeaderRedirectAfterCacheTimeout'),
             ]);
 
index 244fd74..6944bae 100644 (file)
@@ -1,8 +1,9 @@
+<f:if condition="{sendCacheControlHeader}">
 <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresByType text/html {mode}{lifetime}
 </IfModule>
-
+</f:if>
 <f:if condition="{sendCacheControlHeaderRedirectAfterCacheTimeout}">
 <IfModule mod_rewrite.c>
        RewriteEngine On