#730046: fix two inconsistencies on the performance settings page. From: Damien Tournoud --- bootstrap.inc | 2 +- system/system.admin.inc | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git includes/bootstrap.inc includes/bootstrap.inc index cdf584e..b8fb8d1 100644 --- includes/bootstrap.inc +++ includes/bootstrap.inc @@ -1099,7 +1099,7 @@ function drupal_serve_page_from_cache(stdClass $cache) { // do not bother caching the page in a public proxy, because the cached copy // will only be served to that particular user due to Vary: Cookie, unless // the Vary header has been replaced or unset in hook_boot() (see below). - $max_age = !variable_get('page_cache_invoke_hooks', TRUE) && (!isset($_COOKIE[session_name()]) || isset($hook_boot_headers['vary'])) ? variable_get('cache_lifetime', 0) : 0; + $max_age = !variable_get('page_cache_invoke_hooks', TRUE) && (!isset($_COOKIE[session_name()]) || isset($hook_boot_headers['vary'])) ? variable_get('page_cache_maximum_age', 0) : 0; $default_headers['Cache-Control'] = 'public, max-age=' . $max_age; // Entity tag should change if the output changes. diff --git modules/system/system.admin.inc modules/system/system.admin.inc index 9df596d..f7b2135 100644 --- modules/system/system.admin.inc +++ modules/system/system.admin.inc @@ -1630,10 +1630,10 @@ function system_performance_settings() { $cache = variable_get('cache', CACHE_DISABLED); $form['caching']['cache'] = array( - '#type' => 'radios', - '#title' => t('Page cache for anonymous users'), + '#type' => 'checkbox', + '#title' => t('Cache pages for anonymous users'), '#default_value' => $cache, - '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended)')), + '#weight' => -2, ); $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval'); $period[0] = '<' . t('none') . '>'; @@ -1644,6 +1644,13 @@ function system_performance_settings() { '#options' => $period, '#description' => t('The minimum amount of time that will elapse before the caches are recreated.') ); + $form['caching']['page_cache_maximum_age'] = array( + '#type' => 'select', + '#title' => t('Page cache maximum age'), + '#default_value' => variable_get('page_cache_maximum_age', 0), + '#options' => $period, + '#description' => t('The maximum amount of time a page can be served from cache.') + ); $directory = 'public://'; $is_writable = is_dir($directory) && is_writable($directory);