You are here

function update_fix_sessions in Drupal 5

Same name and namespace in other branches
  1. 4 update.php \update_fix_sessions()

System update 130 changes the sessions table, which breaks the update script's ability to use session variables. This changes the table appropriately.

This code, including the 'update_sessions_fixed' variable, may be removed when update 130 is removed. It is part of the Drupal 4.6 to 4.7 migration.

1 call to update_fix_sessions()
update.php in ./update.php
Administrative page for handling updates from one Drupal version to another.

File

./update.php, line 215
Administrative page for handling updates from one Drupal version to another.

Code

function update_fix_sessions() {
  $ret = array();
  if (drupal_get_installed_schema_version('system') < 130 && !variable_get('update_sessions_fixed', FALSE)) {
    if ($GLOBALS['db_type'] == 'mysql') {
      db_query("ALTER TABLE {sessions} ADD cache int(11) NOT NULL default '0' AFTER timestamp");
    }
    elseif ($GLOBALS['db_type'] == 'pgsql') {
      db_add_column($ret, 'sessions', 'cache', 'int', array(
        'default' => 0,
        'not null' => TRUE,
      ));
    }
    variable_set('update_sessions_fixed', TRUE);
  }
}