From 99ce96e5da2cdd92d5bab55ea275f25e05cdd1a4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 12 Aug 2009 11:43:10 +0000 Subject: - Patch #459980 by Xano: rework admin/settings/performance. --- modules/block/block.admin.inc | 24 ++++++++++++++++++++++++ modules/block/block.module | 33 --------------------------------- 2 files changed, 24 insertions(+), 33 deletions(-) (limited to 'modules/block') diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index cc97d5227..436ca29b3 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -6,6 +6,30 @@ * Admin page callbacks for the block module. */ +/** + * Implement hook_form_FORM_ID_alter(). + */ +function block_form_system_performance_settings_alter(&$form, &$form_state) { + $disabled = count(module_implements('node_grants')); + $form['caching']['block_cache'] = array( + '#type' => 'checkbox', + '#title' => t('Cache blocks'), + '#default_value' => variable_get('block_cache', FALSE), + '#disabled' => $disabled, + '#description' => $disabled ? t('Block caching is inactive because you have enabled modules defining content access restrictions.') : NULL, + '#weight' => -1, + ); + + // Check if the "Who's online" block is enabled. + $online_block_enabled = db_query_range("SELECT 1 FROM {block} b WHERE module = 'user' AND delta = 'online' AND status = 1", array(), 0, 1)->fetchField(); + + // If the "Who's online" block is enabled, append some descriptive text to + // the end of the form description. + if ($online_block_enabled) { + $form['page_cache']['cache']['#description'] .= '

' . t('When caching is enabled, anonymous user sessions are only saved to the database when needed, so the "Who\'s online" block does not display the number of anonymous users.') . '

'; + } +} + /** * Menu callback for admin/structure/block. */ diff --git a/modules/block/block.module b/modules/block/block.module index 91f71211b..9d741800a 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -461,39 +461,6 @@ function block_user_validate(&$edit, &$account, $category = NULL) { return $edit; } -/** - * Implement hook_form_FORM_ID_alter(). - */ -function block_form_system_performance_settings_alter(&$form, &$form_state) { - - // Add the block cache fieldset on the performance settings page. - $form['block_cache'] = array( - '#type' => 'fieldset', - '#title' => t('Block cache'), - '#description' => t('Enabling the block cache can offer a performance increase for all users by preventing blocks from being reconstructed on each page load. If the page cache is also enabled, performance increases from enabling the block cache will mainly benefit authenticated users.'), - '#weight' => 0, - ); - - $form['block_cache']['block_cache'] = array( - '#type' => 'radios', - '#title' => t('Block cache'), - '#default_value' => variable_get('block_cache', CACHE_DISABLED), - '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Enabled (recommended)')), - '#disabled' => count(module_implements('node_grants')), - '#description' => t('Note that block caching is inactive when modules defining content access restrictions are enabled.'), - ); - - // Check if the "Who's online" block is enabled. - $online_block_enabled = db_query_range("SELECT 1 FROM {block} b WHERE module = 'user' AND delta = 'online' AND status = 1", array(), 0, 1)->fetchField(); - - // If the "Who's online" block is enabled, append some descriptive text to - // the end of the form description. - if ($online_block_enabled) { - $form['page_cache']['cache']['#description'] .= '

' . t('When caching is enabled, anonymous user sessions are only saved to the database when needed, so the "Who\'s online" block does not display the number of anonymous users.') . '

'; - } - -} - /** * Implement hook_form_FORM_ID_alter(). */ -- cgit v1.2.3