From 748c69985e7839ad645974460e75c033ea6102d2 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 8 Jan 2006 16:15:53 +0000 Subject: - Patch by chx: critical bugfix: fixed the database upgrade path. --- update.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'update.php') diff --git a/update.php b/update.php index f5623e04f..1a8c5812b 100644 --- a/update.php +++ b/update.php @@ -513,7 +513,27 @@ function update_access_denied_page() { '; } +// This code may be removed later. It is part of the Drupal 4.5 to 4.7 migration. +function update_fix_system_table() { + drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE); + $row = db_fetch_object(db_query_range('SELECT * FROM {system}', 0, 1)); + if (!isset($row->weight)) { + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'pgsql': + db_add_column($ret, 'system', 'weight', 'smallint', array('not null' => TRUE, 'default' => 0)); + $ret[] = update_sql('CREATE INDEX {system}_weight_idx ON {system} (weight)'); + break; + case 'mysql': + case 'mysqli': + $ret[] = update_sql("ALTER TABLE {system} ADD weight tinyint(3) unsigned default '0' NOT NULL, ADD KEY (weight)"); + break; + } + } +} + include_once './includes/bootstrap.inc'; +update_fix_system_table(); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_maintenance_theme(); -- cgit v1.2.3