? .buildpath ? .project ? .settings ? blockcache_alwayson_fieldset.patch ? blockcache_fieldset.patch ? sites/default/files ? sites/default/settings.php Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.32 diff -u -p -r1.32 block.admin.inc --- modules/block/block.admin.inc 16 Dec 2008 23:57:31 -0000 1.32 +++ modules/block/block.admin.inc 26 Jan 2009 20:34:22 -0000 @@ -154,7 +154,7 @@ function block_admin_configure(&$form_st '#value' => $delta, ); - $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {block} WHERE module = '%s' AND delta = '%s'", $module, $delta)); + $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title, cache FROM {block} WHERE module = '%s' AND delta = '%s'", $module, $delta)); $form['block_settings'] = array( '#type' => 'fieldset', @@ -262,7 +262,35 @@ function block_admin_configure(&$form_st '#default_value' => $edit['custom'], ); + // Blockcache options. + $options = array( + BLOCK_NO_CACHE => t('Do not cache'), + BLOCK_CACHE_GLOBAL => t('Cache once for everything (global)'), + BLOCK_CACHE_PER_PAGE => t('Per page'), + BLOCK_CACHE_PER_ROLE => t('Per role'), + BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE => t('Per role per page'), + BLOCK_CACHE_PER_USER => t('Per user'), + BLOCK_CACHE_PER_USER | BLOCK_CACHE_PER_PAGE => t('Per user per page'), + ); + + // Create cache settings fieldset. + $form['cache_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Cache settings'), + '#weight' => 1, + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['cache_settings']['cache'] = array( + '#type' => 'select', + '#title' => t('Cache setting'), + '#description' => t('Select the appropriate cache setting for this block.'), + '#options' => $options, + '#default_value' => $edit['cache'], + ); + $form['submit'] = array( + '#weight' => 10, '#type' => 'submit', '#value' => t('Save block'), ); @@ -280,7 +308,7 @@ function block_admin_configure_validate( function block_admin_configure_submit($form, &$form_state) { if (!form_get_errors()) { - db_query("UPDATE {block} SET visibility = %d, pages = '%s', custom = %d, title = '%s' WHERE module = '%s' AND delta = '%s'", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $form_state['values']['delta']); + db_query("UPDATE {block} SET visibility = %d, pages = '%s', custom = %d, title = '%s', cache = %d WHERE module = '%s' AND delta = '%s'", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['cache'], $form_state['values']['module'], $form_state['values']['delta']); db_query("DELETE FROM {block_role} WHERE module = '%s' AND delta = '%s'", $form_state['values']['module'], $form_state['values']['delta']); foreach (array_filter($form_state['values']['roles']) as $rid) { db_query("INSERT INTO {block_role} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_state['values']['module'], $form_state['values']['delta']); Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.319 diff -u -p -r1.319 block.module --- modules/block/block.module 21 Jan 2009 16:58:41 -0000 1.319 +++ modules/block/block.module 26 Jan 2009 20:34:23 -0000 @@ -540,7 +540,7 @@ function _block_get_cache_id($block) { // it brings too many chances of having unwanted output get in the cache // and later be served to other users. We therefore exclude user 1 from // block caching. - if (variable_get('block_cache', 0) && $block->cache != BLOCK_NO_CACHE && $user->uid != 1) { + if ($block->cache != BLOCK_NO_CACHE && $user->uid != 1) { $cid_parts = array(); // Start with common sub-patterns: block identification, theme, language. Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.122 diff -u -p -r1.122 system.admin.inc --- modules/system/system.admin.inc 22 Jan 2009 12:46:07 -0000 1.122 +++ modules/system/system.admin.inc 26 Jan 2009 20:34:24 -0000 @@ -1349,21 +1349,6 @@ function system_performance_settings() { '#description' => t("By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression."), ); - $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.'), - ); - - $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.'), - ); - $form['bandwidth_optimizations'] = array( '#type' => 'fieldset', '#title' => t('Bandwidth optimizations'),