Commit 748c6998 authored by Dries's avatar Dries

- Patch by chx: critical bugfix: fixed the database upgrade path.

parent df82a1ed
......@@ -1398,18 +1398,3 @@ function system_update_166() {
return $ret;
}
function system_update_167() {
$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;
}
return $ret;
}
......@@ -513,7 +513,27 @@ function update_access_denied_page() {
</ol>';
}
// 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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment