You are here

function update_fix_watchdog in Drupal 4

Same name and namespace in other branches
  1. 5 update.php \update_fix_watchdog()

System update 142 changes the watchdog table, which breaks the update script's ability to use logging. This changes the table appropriately.

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

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

File

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

Code

function update_fix_watchdog() {
  if (drupal_get_installed_schema_version('system') < 142 && !variable_get('update_watchdog_fixed', FALSE)) {
    switch ($GLOBALS['db_type']) {
      case 'pgsql':
        $ret = array();
        db_add_column($ret, 'watchdog', 'referer', 'varchar(128)', array(
          'not null' => TRUE,
          'default' => "''",
        ));
        break;
      case 'mysql':
      case 'mysqli':
        db_query("ALTER TABLE {watchdog} ADD COLUMN referer varchar(128) NOT NULL");
        break;
    }
    variable_set('update_watchdog_fixed', TRUE);
  }
}