summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArto Bendiken2007-08-06 14:36:47 (GMT)
committerArto Bendiken2007-08-06 14:36:47 (GMT)
commitae413a356d63e6bf20e2322f05a8bec360cc1fd8 (patch)
tree5168043ebc4a2c9b04d202cd36e6f7f642801f43
parent1ff8e62b359c5e16792265953a00d92ab4c72a60 (diff)
Imported latest version from SVN development repository.
Changelog: - #153179 Backported corrected front page handling and Boost page footer expiration time from 5.x branch (kudos to Axel). - #103884 Backported .htaccess improvements from 5.x branch (kudos to Axel). - Updated credits listing in README.txt.
-rw-r--r--README.txt2
-rw-r--r--boost.api.inc9
-rw-r--r--boost.module2
-rw-r--r--htaccess/boosted.txt28
4 files changed, 28 insertions, 13 deletions
diff --git a/README.txt b/README.txt
index 98efe80..dd15005 100644
--- a/README.txt
+++ b/README.txt
@@ -145,3 +145,5 @@ Post feature requests and bug reports to the issue tracking system at:
CREDITS
-------
Developed and maintained by Arto Bendiken <http://bendiken.net/>
+Ported to Drupal 5.x by Alexander I. Grafov <http://drupal.ru/>
+Miscellaneous contributions by: Jacob Peddicord, Justin Miller.
diff --git a/boost.api.inc b/boost.api.inc
index d16d531..1f0cf59 100644
--- a/boost.api.inc
+++ b/boost.api.inc
@@ -117,8 +117,11 @@ function boost_cache_get($path) {
* Replaces the cached contents of the specified page, if stale.
*/
function boost_cache_set($path, $data = '') {
- // Append the Boost footer with the current timestamp
- $data = rtrim($data) . "\n" . str_replace('%date', date('Y-m-d H:i:s'), BOOST_BANNER);
+ // Append the Boost footer with the relevant timestamps
+ $time = time();
+ $cached_at = date('Y-m-d H:i:s', $time);
+ $expires_at = date('Y-m-d H:i:s', $time + variable_get('cache_lifetime', 600));
+ $data = rtrim($data) . "\n" . str_replace(array('%cached_at', '%expires_at'), array($cached_at, $expires_at), BOOST_BANNER);
// Execute the pre-process function if one has been defined
if (function_exists(BOOST_PRE_PROCESS_FUNCTION))
@@ -169,7 +172,7 @@ function boost_cache_directory($user_id = 0, $host = NULL) {
* Returns the static file path for a Drupal page.
*/
function boost_file_path($path) {
- if ($path == BOOST_FRONTPAGE)
+ if (empty($path) || $path == BOOST_FRONTPAGE)
$path = 'index'; // special handling for Drupal front page
return implode('/', array(boost_cache_directory(), $path)) . BOOST_FILE_EXTENSION;
}
diff --git a/boost.module b/boost.module
index 4831921..44d5229 100644
--- a/boost.module
+++ b/boost.module
@@ -29,7 +29,7 @@ define('BOOST_COOKIE', variable_get('boost_cookie', 'DRUPAL_UID'))
// This line is appended to the generated static files; it is very useful
// for troubleshooting (e.g. determining whether one got the dynamic or
// static version):
-define('BOOST_BANNER', variable_get('boost_banner', "<!-- Page cached by Boost at %date -->\n"));
+define('BOOST_BANNER', variable_get('boost_banner', "<!-- Page cached by Boost at %cached_at, expires at %expires_at -->\n"));
// This is needed since the $user object is already destructed in _boost_ob_handler():
define('BOOST_USER_ID', $GLOBALS['user']->uid);
diff --git a/htaccess/boosted.txt b/htaccess/boosted.txt
index f89b084..9b37bff 100644
--- a/htaccess/boosted.txt
+++ b/htaccess/boosted.txt
@@ -79,27 +79,37 @@ DirectoryIndex index.php
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
- # Rewrite rules for static page caching provided by the Boost module
+ # Rewrite rules for static page caching provided by the Boost module:
# BOOST START
+ <IfModule mod_headers.c>
+ Header add Expires "Sun, 19 Nov 1978 05:00:00 GMT"
+ Header add Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
+ </IfModule>
<IfModule mod_mime.c>
- AddCharset utf-8 .html
+ AddCharset utf-8 .html
</IfModule>
+ RewriteCond %{REQUEST_METHOD} ^GET$
+ RewriteCond %{REQUEST_URI} ^/$
+ RewriteCond %{QUERY_STRING} ^$
+ RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
+ RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/index.html -f
+ RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/index.html [L]
+ RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{REQUEST_URI} !^/cache
RewriteCond %{REQUEST_URI} !^/user/login
RewriteCond %{REQUEST_URI} !^/admin
- RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
- RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
- RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI} -d
- RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}/index.html -f
+ RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
+ RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI} -d
+ RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI}/index.html -f
RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1/index.html [L]
+ RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{REQUEST_URI} !^/cache
RewriteCond %{REQUEST_URI} !^/user/login
RewriteCond %{REQUEST_URI} !^/admin
- RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
- RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
- RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}.html -f
+ RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
+ RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI}.html -f
RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1.html [L]
# BOOST END