diff --git a/INSTALL.txt b/INSTALL.txt index 02688b4c8351df0192b557869dbf7c1d2cdf5a9b..c2927714d7a9101b98f56c6a21b45219e0b91859 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -9,7 +9,7 @@ The `path' and `pathauto' modules are recommended. In order for the static files to be correctly expired, the Drupal cron job must be correctly setup to execute more often than, or as often as, the -cache lifetime interval. +cache lifetime interval you specify. Since the static page caching is implemented with mod_rewrite directives, Apache version 1.3 or 2.x with mod_rewrite enabled is required (if Drupal's @@ -20,25 +20,27 @@ The `drush' module is required for (optional) command line usage. INSTALLATION ------------ -1. Go to administer >> settings and ensure that Drupal's clean URLs are - enabled and working properly on your site. +1. Go to Administer >> Site configuration >> Clean URLs and ensure that + Drupal's clean URLs are enabled and working properly on your site. 2. Copy all the module files into a subdirectory called modules/boost/ under your Drupal installation directory. -3. Go to administer >> modules and enable the Boost module. +3. Go to Administer >> Site building >> Modules and enable the Boost module. -4. Go to administer >> settings >> boost to review and change the - configuration options to your liking. +4. Go to Administer >> Site configuration >> Performance >> Boost to review + and change the module's configuration options to your liking. -5. Go to administer >> settings and enable static caching. +5. Go to Administer >> Site configuration >> Performance, specify the cache + directory (must be writable by the web server) and enable static caching. 6. Log out from Drupal (or use another browser) and browse around your site as the anonymous user. Ensure that static files are indeed being - generated into the Boost cache directory. + generated into the Boost cache directory you specified above. 7. IMPORTANT: replace your .htaccess file in the Drupal installation - directory with the file from modules/boost/htaccess/boosted.txt. + directory with the file from modules/boost/htaccess/boosted.txt, + customizing the mod_rewrite rules to your particular setup if needed. (If you fail to do this, static page caching will NOT work!) 8. (See README.txt for information on submitting bug reports.) diff --git a/README.txt b/README.txt index dd15005546fd3e01d8fa7519e1c07635550e190c..a26da48792c8c5ea6876e88895cf3d65ff732af6 100644 --- a/README.txt +++ b/README.txt @@ -5,7 +5,7 @@ you're an experienced user and don't mind figuring things out on your own. DESCRIPTION ----------- -This module provides static page caching for Drupal 4.7, enabling a +This module provides static page caching for Drupal 5.x, enabling a potentially very significant performance and scalability boost for heavily-trafficked Drupal sites. diff --git a/boost.module b/boost.module index 44d5229463f698ffdebc5ec5be86d93b3078304f..865f73f377d4f2709565576a0515b3e978a54ac4 100644 --- a/boost.module +++ b/boost.module @@ -76,6 +76,14 @@ function boost_menu($may_cache) { $access = user_access('administer cache'); $items = array(); if ($may_cache) { + $items[] = array( + 'path' => 'admin/settings/performance/boost', + 'title' => t('Boost'), + 'description' => t('Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('boost_settings'), + 'access' => user_access('administer site configuration'), + ); // TODO: define menu actions for cache administration. } return $items; @@ -168,9 +176,9 @@ function boost_exit($destination = NULL) { */ function boost_form_alter($form_id, &$form) { // Alter Drupal's settings form by hiding the default cache enabled/disabled control (which will now always default to CACHE_DISABLED), and add our own control instead. - if ($form_id == 'system_settings_form') { + if ($form_id == 'system_performance_settings') { require_once BOOST_PATH . '/boost.admin.inc'; - $form['cache'] = boost_system_settings_form($form['cache']); + $form['page_cache'] = boost_system_settings_form($form['page_cache']); } } @@ -269,7 +277,7 @@ function boost_user($op, &$edit, &$account, $category = NULL) { */ function boost_settings() { require_once BOOST_PATH . '/boost.admin.inc'; - return boost_settings_form(); + return system_settings_form(boost_settings_form()); } ////////////////////////////////////////////////////////////////////////////// diff --git a/htaccess/boosted.txt b/htaccess/boosted.txt index 9b37bffa5f9d878f050c9cb5ea9a213a6dc329e6..3358a0b58445dd98961cb3324e8a6c75d8c9d4ab 100644 --- a/htaccess/boosted.txt +++ b/htaccess/boosted.txt @@ -3,13 +3,14 @@ # # Protect files and directories from prying eyes. - - Order deny,allow - Deny from all + + Order allow,deny -# Set some options. +# Don't show directory listings for URLs which map to a directory. Options -Indexes + +# Follow symbolic links in this directory. Options +FollowSymLinks # Customized error messages. @@ -21,29 +22,43 @@ DirectoryIndex index.php # Override PHP settings. More in sites/default/settings.php # but the following cannot be changed at runtime. -# PHP 4, Apache 1 +# PHP 4, Apache 1. php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 + php_value mbstring.http_input pass + php_value mbstring.http_output pass + php_value mbstring.encoding_translation 0 -# PHP 4, Apache 2 +# PHP 4, Apache 2. php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 + php_value mbstring.http_input pass + php_value mbstring.http_output pass + php_value mbstring.encoding_translation 0 -# PHP 5, Apache 1 and 2 +# PHP 5, Apache 1 and 2. php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 + php_value mbstring.http_input pass + php_value mbstring.http_output pass + php_value mbstring.encoding_translation 0 -# Reduce the time dynamically generated pages are cache-able. +# Requires mod_expires to be enabled. + # Enable expirations. + ExpiresActive On + # Cache all files for 2 weeks after access (A). + ExpiresDefault A1209600 + # Do not cache dynamically generated pages. ExpiresByType text/html A1 @@ -51,17 +66,21 @@ DirectoryIndex index.php RewriteEngine on - # If your site can be accessed both with and without the prefix www. - # you can use one of the following settings to force user to use only one option: + # If your site can be accessed both with and without the 'www.' prefix, you + # can use one of the following settings to redirect users to your preferred + # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option: # - # If you want the site to be accessed WITH the www. only, adapt and uncomment the following: - # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] - # RewriteRule .* http://www.example.com/ [L,R=301] + # To redirect all users to access the site WITH the 'www.' prefix, + # (http://example.com/... will be redirected to http://www.example.com/...) + # adapt and uncomment the following: + # RewriteCond %{HTTP_HOST} ^example\.com$ [NC] + # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] # - # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following: - # RewriteCond %{HTTP_HOST} !^example\.com$ [NC] - # RewriteRule .* http://example.com/ [L,R=301] - + # To redirect all users to access the site WITHOUT the 'www.' prefix, + # (http://www.example.com/... will be redirected to http://example.com/...) + # adapt and uncomment the following: + # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] + # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] # Modify the RewriteBase if you are using Drupal in a subdirectory and # the rewrite rules are not working properly. diff --git a/htaccess/default.txt b/htaccess/default.txt index ce35f6d153cfa2878f5060b73cfea2dd0015727d..b43f858650c2cc3c813faf310a129de23bcb8d73 100644 --- a/htaccess/default.txt +++ b/htaccess/default.txt @@ -3,13 +3,14 @@ # # Protect files and directories from prying eyes. - - Order deny,allow - Deny from all + + Order allow,deny -# Set some options. +# Don't show directory listings for URLs which map to a directory. Options -Indexes + +# Follow symbolic links in this directory. Options +FollowSymLinks # Customized error messages. @@ -21,29 +22,43 @@ DirectoryIndex index.php # Override PHP settings. More in sites/default/settings.php # but the following cannot be changed at runtime. -# PHP 4, Apache 1 +# PHP 4, Apache 1. php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 + php_value mbstring.http_input pass + php_value mbstring.http_output pass + php_value mbstring.encoding_translation 0 -# PHP 4, Apache 2 +# PHP 4, Apache 2. php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 + php_value mbstring.http_input pass + php_value mbstring.http_output pass + php_value mbstring.encoding_translation 0 -# PHP 5, Apache 1 and 2 +# PHP 5, Apache 1 and 2. php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 + php_value mbstring.http_input pass + php_value mbstring.http_output pass + php_value mbstring.encoding_translation 0 -# Reduce the time dynamically generated pages are cache-able. +# Requires mod_expires to be enabled. + # Enable expirations. + ExpiresActive On + # Cache all files for 2 weeks after access (A). + ExpiresDefault A1209600 + # Do not cache dynamically generated pages. ExpiresByType text/html A1 @@ -51,17 +66,21 @@ DirectoryIndex index.php RewriteEngine on - # If your site can be accessed both with and without the prefix www. - # you can use one of the following settings to force user to use only one option: + # If your site can be accessed both with and without the 'www.' prefix, you + # can use one of the following settings to redirect users to your preferred + # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option: # - # If you want the site to be accessed WITH the www. only, adapt and uncomment the following: - # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] - # RewriteRule .* http://www.example.com/ [L,R=301] + # To redirect all users to access the site WITH the 'www.' prefix, + # (http://example.com/... will be redirected to http://www.example.com/...) + # adapt and uncomment the following: + # RewriteCond %{HTTP_HOST} ^example\.com$ [NC] + # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] # - # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following: - # RewriteCond %{HTTP_HOST} !^example\.com$ [NC] - # RewriteRule .* http://example.com/ [L,R=301] - + # To redirect all users to access the site WITHOUT the 'www.' prefix, + # (http://www.example.com/... will be redirected to http://example.com/...) + # adapt and uncomment the following: + # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] + # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] # Modify the RewriteBase if you are using Drupal in a subdirectory and # the rewrite rules are not working properly.