? .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.33
diff -u -p -r1.33 block.admin.inc
--- modules/block/block.admin.inc	27 Jan 2009 00:22:25 -0000	1.33
+++ modules/block/block.admin.inc	29 Jan 2009 19:13:06 -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.320
diff -u -p -r1.320 block.module
--- modules/block/block.module	27 Jan 2009 00:22:25 -0000	1.320
+++ modules/block/block.module	29 Jan 2009 19:13:06 -0000
@@ -595,7 +595,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.123
diff -u -p -r1.123 system.admin.inc
--- modules/system/system.admin.inc	27 Jan 2009 00:22:26 -0000	1.123
+++ modules/system/system.admin.inc	29 Jan 2009 19:13:09 -0000
@@ -1349,20 +1349,18 @@ 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.'),
-  );
+  $node_grants_modules = array_unique(module_implements('node_grants'));
+  sort($node_grants_modules);
 
-  $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.'),
-  );
+  if (count($node_grants_modules) > 0) {
+    $form['block_cache'] = array(
+      '#type' => 'fieldset',
+      '#title' => 'Block cache',
+    );
+    $form['block_cache']['block_cache_disabled'] = array(
+      '#markup' => t('<strong class="error">The following enabled modules are incompatible with block cache which is now completely disabled: %modules</strong>', array('%modules' => implode(', ', $node_grants_modules))),
+    );
+  }
 
   $form['bandwidth_optimizations'] = array(
     '#type' => 'fieldset',
