diff options
Diffstat (limited to 'modules/system/system.install')
-rw-r--r-- | modules/system/system.install | 46 |
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. */ |