1 redirect.install redirect_update_1001()

Rename the language column to langcode, drop inactive redirects.

File

core/modules/redirect/redirect.install, line 135
Install, update and uninstall functions for the Redirect module.

Code

function redirect_update_1001() {
  if (db_index_exists('redirect', 'source_language')) {
    db_drop_index('redirect', 'source_language');
  }
  if (db_field_exists('redirect', 'language')) {
    $spec = array(
      'description' => 'The language this redirect is for; if blank, the alias will be used for unknown languages.',
      'type' => 'varchar',
      'length' => 12,
      'not null' => TRUE,
      'default' => 'und',
    );
    db_change_field('redirect', 'language', 'langcode', $spec);
    db_add_index('redirect', 'source_langcode', array('source', 'langcode'));
  }
  // In Drupal 7 the status field marked a redirect as being disabled. In
  // Backdrop there's no such setting, so we delete all disabled redirects.
  // @see https://github.com/backdrop/backdrop-issues/issues/6281
  if (db_field_exists('redirect', 'status')) {
    db_delete('redirect')->condition('status', 0)->execute();
  }
}