summaryrefslogtreecommitdiff
path: root/modules/system/system.install
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-08-19 08:08:45 +0000
committerDries Buytaert <dries@buytaert.net>2007-08-19 08:08:45 +0000
commit74292cd0625032180b2d178ae1c57e51462f121e (patch)
tree79ffaafcf1cd4c7b4a2dd2d33512228a0efb597c /modules/system/system.install
parente9c36f969752488ca33da745b15805c489932a30 (diff)
downloadbrdo-74292cd0625032180b2d178ae1c57e51462f121e.tar.gz
brdo-74292cd0625032180b2d178ae1c57e51462f121e.tar.bz2
- Patch #80951 by killes, yched et al: block caching.
Diffstat (limited to 'modules/system/system.install')
-rw-r--r--modules/system/system.install46
1 files changed, 46 insertions, 0 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 56205fdc9..ffa68b16a 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -3481,6 +3481,52 @@ function system_update_6026() {
}
/**
+ * Add block cache.
+ */
+function system_update_6027() {
+ $ret = array();
+
+ // Create the blocks.cache column.
+ db_add_field($ret, 'blocks', 'cache', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'));
+
+ // Create the cache_block table.
+ $schema['cache_block'] = array(
+ 'fields' => array(
+ 'cid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
+ 'data' => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'),
+ 'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
+ 'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
+ 'headers' => array('type' => 'text', 'not null' => FALSE),
+ 'serialized' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)
+ ),
+ 'indexes' => array('expire' => array('expire')),
+ 'primary key' => array('cid'),
+ );
+ db_create_table($ret, 'cache_block', $schema['cache_block']);
+
+ // Fill in the values for the new 'cache' column,
+ // by refreshing the {blocks} table.
+ global $theme, $custom_theme;
+ $old_theme = $theme;
+ $themes = list_themes();
+
+ $result = db_query("SELECT DISTINCT theme FROM {blocks}");
+ while ($row = db_fetch_array($result)) {
+ if (array_key_exists($row['theme'], $themes)) {
+ // Set up global values so that _blocks_rehash()
+ // operates on the expected theme.
+ $theme = NULL;
+ $custom_theme = $row['theme'];
+ _block_rehash();
+ }
+ }
+
+ $theme = $old_theme;
+
+ return $ret;
+}
+
+/**
* @} End of "defgroup updates-5.x-to-6.x"
* The next series of updates should start at 7000.
*/