summaryrefslogtreecommitdiff
path: root/includes/update.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-20 15:06:51 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-20 15:06:51 +0000
commitaadc94a102375f3e8656c23cb711097f827be96e (patch)
tree1f2c1d13750bdb63f55e55c962360ad1c0ed3300 /includes/update.inc
parent5717ba536ec238e9b587e3fed6e3304e3d0d8056 (diff)
downloadbrdo-aadc94a102375f3e8656c23cb711097f827be96e.tar.gz
brdo-aadc94a102375f3e8656c23cb711097f827be96e.tar.bz2
- Patch #582948 by David_Rothstein: improve safety of schema manipulation.
Diffstat (limited to 'includes/update.inc')
-rw-r--r--includes/update.inc92
1 files changed, 47 insertions, 45 deletions
diff --git a/includes/update.inc b/includes/update.inc
index 8157eeabe..3574f2d94 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -106,53 +106,55 @@ function update_prepare_d7_bootstrap() {
// The new cache_bootstrap bin is required to bootstrap to
// DRUPAL_BOOTSTRAP_SESSION, so create it here rather than in
// update_fix_d7_requirements().
- $cache_bootstrap = array(
- 'description' => 'Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.',
- 'fields' => array(
- 'cid' => array(
- 'description' => 'Primary Key: Unique cache ID.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'data' => array(
- 'description' => 'A collection of data to cache.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- ),
- 'expire' => array(
- 'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'created' => array(
- 'description' => 'A Unix timestamp indicating when the cache entry was created.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'headers' => array(
- 'description' => 'Any custom HTTP headers to be added to cached data.',
- 'type' => 'text',
- 'not null' => FALSE,
+ if (!db_table_exists('cache_bootstrap')) {
+ $cache_bootstrap = array(
+ 'description' => 'Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.',
+ 'fields' => array(
+ 'cid' => array(
+ 'description' => 'Primary Key: Unique cache ID.',
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ 'default' => '',
+ ),
+ 'data' => array(
+ 'description' => 'A collection of data to cache.',
+ 'type' => 'blob',
+ 'not null' => FALSE,
+ 'size' => 'big',
+ ),
+ 'expire' => array(
+ 'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'created' => array(
+ 'description' => 'A Unix timestamp indicating when the cache entry was created.',
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'headers' => array(
+ 'description' => 'Any custom HTTP headers to be added to cached data.',
+ 'type' => 'text',
+ 'not null' => FALSE,
+ ),
+ 'serialized' => array(
+ 'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
+ 'type' => 'int',
+ 'size' => 'small',
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
),
- 'serialized' => array(
- 'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
- 'type' => 'int',
- 'size' => 'small',
- 'not null' => TRUE,
- 'default' => 0,
+ 'indexes' => array(
+ 'expire' => array('expire'),
),
- ),
- 'indexes' => array(
- 'expire' => array('expire'),
- ),
- 'primary key' => array('cid'),
- );
- db_create_table('cache_bootstrap', $cache_bootstrap);
+ 'primary key' => array('cid'),
+ );
+ db_create_table('cache_bootstrap', $cache_bootstrap);
+ }
}
/**