update_fix_watchdog

  1. drupal
    1. 4.7
    2. 5
Versions
4.7 – 5 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.

Code

./update.php, line 259

<?php
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);
  }
}
?>