? boost-204174.patch Index: boost.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.admin.inc,v retrieving revision 1.1.2.1.2.3.2.25 diff -u -p -r1.1.2.1.2.3.2.25 boost.admin.inc --- boost.admin.inc 9 Jun 2009 08:44:57 -0000 1.1.2.1.2.3.2.25 +++ boost.admin.inc 9 Jun 2009 09:52:04 -0000 @@ -16,38 +16,42 @@ */ function boost_admin_settings($form = array()) { // Take over the relevant existing settings - $form['#title'] = t('Static page cache'); - $form['cache'] = array('#type' => 'hidden','#value' => CACHE_DISABLED); - unset($form['page_compression']); // we don't support this - // Inject Boost-specific settings + + + $description = '

'. t("The normal cache mode is suitable for most sites and does not cause any side effects. The aggressive cache mode causes Drupal to skip the loading (boot) and unloading (exit) of enabled modules when serving a cached page. This results in an additional performance boost but can cause unwanted side effects.") .'

'; + + $problem_modules = array_diff(array_unique(array_merge(module_implements('boot'), module_implements('exit'))), array(0 => 'boost')); + sort($problem_modules); + + if (count($problem_modules) > 0) { + $description .= '

'. t('The following enabled modules are incompatible with aggressive mode caching and will probably not function properly: %modules', array('%modules' => implode(', ', $problem_modules))) .'.

'; + } + else { + $description .= '

'. t('Currently, all enabled modules are compatible with the aggressive caching policy. Please note, if you use aggressive caching and enable new modules, you will need to check this page again to ensure compatibility.') .'

'; + } + + $form['boost'] = array( '#type' => 'radios', - '#title' => t('Static page cache'), + '#title' => t('Boost - Static page cache'), '#default_value' => variable_get('boost', CACHE_DISABLED), '#options' => array(CACHE_DISABLED => t('Disabled'), 1 => t('Enabled')), '#description' => t('Static page caching is a mechanism that stores dynamically generated web pages as HTML files in a special cache directory located under the Drupal installation directory. By caching a web page in this manner, the web server can serve it out in the fastest possible manner, without invoking PHP or Drupal at all. While this does provide a significant performance and scalability boost, you should note that it could have negative usability side-effects unless your site is targeted at an audience consisting mostly of "anonymous" visitors.'), '#weight' => -10, ); - $form['boost_file_path'] = array( - '#type' => 'textfield', - '#title' => t('Cache file path'), - '#default_value' => BOOST_FILE_PATH, - '#size' => 60, - '#maxlength' => 255, - '#required' => TRUE, - '#description' => t('A file system path where the static cache files will be stored. This directory has to exist and be writable by Drupal. The default setting is to store the files in a directory named %default-path under the Drupal installation directory. If you change this, you must also change the URL rewrite rules in your web server configuration (.htaccess for Apache, lighttpd.conf for Lighttpd), or caching will not work.', array('%default-path' => boost_cache_directory(NULL, FALSE))), - '#weight' => -5, + $form['cache'] = array( + '#type' => 'radios', + '#title' => t('Core - Database page cache'), + '#default_value' => variable_get('cache', CACHE_DISABLED), + '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended for production sites, no side effects)'), CACHE_AGGRESSIVE => t('Aggressive (experts only, possible side effects)')), + '#description' => t("If boost can not or will not cache the page, then the database will try to cache it. If boost can cache the page then it will not appear in the database cache. This is the standard Drupal cache.") . $description, + '#weight' => -8, ); $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 64800, 86400, 2*86400, 3*86400, 4*86400, 5*86400, 6*86400, 7*86400, 14*86400, 21*86400, 28*86400), 'format_interval'); - $period[0] = t('none'); + $period[0] = '<' . t('none') . '>'; + $form['cache_lifetime']['#title'] = t('Default minimum cache lifetime'); $form['cache_lifetime']['#options'] = $period; - $form['boost_gzip'] = array( - '#type' => 'checkbox', - '#title' => t('Gzip cached pages'), - '#default_value' => BOOST_GZIP, - '#description' => t('This reduces bandwith used and allows for faster page loads. The full effects of this setting do no take place until the cache has been cleared and .htaccess has the correct set of rules in place.'), - ); // Cacheability settings // TODO: update to use Drupal 6.x core code. @@ -59,13 +63,13 @@ function boost_admin_settings($form = ar } $form['cacheability'] = array( '#type' => 'fieldset', - '#title' => t('Cacheability settings'), + '#title' => t('Boost cacheability settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['cacheability']['boost_cacheability_option'] = array( '#type' => 'radios', - '#title' => t('Cache specific pages'), + '#title' => t('Statically cache specific pages'), '#options' => $options, '#default_value' => BOOST_CACHEABILITY_OPTION, ); @@ -79,10 +83,19 @@ function boost_admin_settings($form = ar // Advanced settings $form['advanced'] = array( '#type' => 'fieldset', - '#title' => t('Advanced settings'), + '#title' => t('Boost advanced settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); + $form['advanced']['boost_file_path'] = array( + '#type' => 'textfield', + '#title' => t('Cache file path'), + '#default_value' => BOOST_FILE_PATH, + '#size' => 60, + '#maxlength' => 255, + '#required' => TRUE, + '#description' => t('A file system path where the static cache files will be stored. This directory has to exist and be writable by Drupal. The default setting is to store the files in a directory named %default-path under the Drupal installation directory. If you change this, you must also change the URL rewrite rules in your web server configuration (.htaccess for Apache, lighttpd.conf for Lighttpd), or caching will not work.', array('%default-path' => boost_cache_directory(NULL, FALSE))), + ); $form['advanced']['boost_expire_cron'] = array( '#type' => 'radios', '#title' => t('Purge expired cache files on cron runs'), @@ -149,7 +162,7 @@ function boost_admin_settings($form = ar $htaccess = boost_admin_generate_htaccess(variable_get('boost_server_name_http_host', '%{SERVER_NAME}'), variable_get('boost_document_root', '%{DOCUMENT_ROOT}'), 'cache', 'gz', variable_get('boost_file_extension', '.html')); $form['htaccess'] = array( '#type' => 'fieldset', - '#title' => t('Apache .htaccess settings generation'), + '#title' => t('Boost Apache .htaccess settings generation'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => t('!link', array('!link' => l(t('Explanation of .htaccess variables'), 'http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html'))), @@ -203,9 +216,6 @@ function boost_admin_settings_submit($fo variable_del('boost_previously'); extract($form_state['values'], EXTR_SKIP | EXTR_REFS); - // Forcibly disable Drupal's built-in SQL caching to prevent any conflicts of interest: - variable_set('cache', CACHE_DISABLED); - if (empty($boost) && !empty($boost_previously)) { // the cache was previously enabled if (boost_cache_clear_all()) { drupal_set_message(t('Static page cache cleared.')); Index: boost.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v retrieving revision 1.3.2.2.2.5.2.50 diff -u -p -r1.3.2.2.2.5.2.50 boost.module --- boost.module 9 Jun 2009 08:00:22 -0000 1.3.2.2.2.5.2.50 +++ boost.module 9 Jun 2009 09:52:04 -0000 @@ -23,7 +23,7 @@ define('BOOST_PRE_PROCESS_FUNCTION', var define('BOOST_POST_UPDATE_COMMAND', variable_get('boost_post_update_command', '')); define('BOOST_CRON_LIMIT', variable_get('boost_cron_limit', 100)); define('BOOST_ONLY_ASCII_PATH', variable_get('boost_only_ascii_path', TRUE)); -define('BOOST_GZIP', variable_get('boost_gzip', TRUE)); +define('BOOST_GZIP', variable_get('page_compression', TRUE)); define('BOOST_GZIP_FILE_PATH', str_replace(BOOST_ROOT_CACHE_PATH . '/', BOOST_ROOT_CACHE_PATH . '/gz/', BOOST_FILE_PATH)); define('BOOST_CLEAR_CACHE_OFFLINE', variable_get('boost_clear_cache_offline', TRUE)); define('BOOST_HALT_ON_ERRORS', variable_get('boost_halt_on_errors', FALSE)); @@ -78,11 +78,10 @@ function boost_init() { } // Make sure the page is/should be cached according to our current configuration - if ( strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') === FALSE - || variable_get('site_offline', 0) - || $_SERVER['REQUEST_METHOD'] != 'GET' + if ( strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') === FALSE + || variable_get('site_offline', 0) + || $_SERVER['REQUEST_METHOD'] != 'GET' || $_SERVER['SERVER_SOFTWARE'] === 'PHP CLI' - || variable_get('cache', CACHE_DISABLED) || !BOOST_ENABLED || isset($_GET['nocache']) || !boost_is_cacheable($GLOBALS['_boost_path']) @@ -97,6 +96,7 @@ function boost_init() { } // We only generate cached pages for anonymous visitors. else { + $GLOBALS['conf']['cache'] = CACHE_DISABLED; ob_start('_boost_ob_handler'); } } @@ -148,6 +148,7 @@ function boost_form_alter(&$form, $form_ case 'system_performance_settings': module_load_include('inc', 'boost', 'boost.admin'); $form['page_cache'] = boost_admin_settings($form['page_cache']); + $form['page_cache']['#description'] = t('Enabling the page cache will offer a significant performance boost. Drupal can store and send compressed cached pages requested by anonymous users. By caching the first request to the page, Drupal does not have to construct the page each time it is viewed. The page must first be visited by an anonymous user in order for the cache to work on subsequent requests for that page. Boost & Core caching do not work for logged in users.'); $form['#validate'][] = 'boost_admin_settings_validate'; $form['#submit'][] = 'boost_admin_settings_submit'; $form['clear_cache']['clear']['#submit'][0] = 'boost_admin_clear_cache_submit';