You are here

taxonomy_redirect.install in Taxonomy Redirect 5

Same filename and directory in other branches
  1. 6 taxonomy_redirect.install

File

taxonomy_redirect.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function taxonomy_redirect_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("CREATE TABLE if not exists {taxonomy_redirect} (\n        vid int(10) unsigned NOT NULL default '0',\n        module varchar(255) NOT NULL default '',\n        path text NOT NULL,\n        tid int(10) unsigned default NULL,\n        separator_replace varchar(1) default '',\n        remove_text varchar(250) default NULL,\n        filter int(4) default '1',\n        path_case varchar(25) NOT NULL default 'No transform',\n        key (vid)\n      ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    default:
      break;
  }
}

/**
 * hook_update #1
 */
function taxonomy_redirect_update_1() {
  return _system_update_utf8(array(
    'taxonomy_redirect',
  ));
}

/**
 * hook_update #2
 */
function taxonomy_redirect_update_2() {
  $ret = array();
  $ret[] = update_sql("UPDATE {taxonomy_redirect} SET path = concat(path, '/!tid') WHERE path NOT LIKE '%/!tid'");
  return $ret;
}

/**
 * hook_update #3
 */
function taxonomy_redirect_update_3() {
  $ret = array();
  $ret[] = update_sql("ALTER TABLE {taxonomy_redirect} CHANGE `path` `path` TEXT NOT NULL");
  $ret[] = update_sql("ALTER TABLE {taxonomy_redirect}\n                       ADD (tid int(10) unsigned default NULL,\n                            separator_replace varchar(1) default '',\n                            remove_text varchar(250) default NULL,\n                            filter int(4) default '1')");
  return $ret;
}

/**
 * hook_update #4
 */
function taxonomy_redirect_update_4() {
  $ret = array();
  $ret[] = update_sql("ALTER TABLE {taxonomy_redirect}\n                       ADD (path_case varchar(25) NOT NULL default 'No transform')");
  return $ret;
}

Functions

Namesort descending Description
taxonomy_redirect_install Implementation of hook_install().
taxonomy_redirect_update_1 hook_update #1
taxonomy_redirect_update_2 hook_update #2
taxonomy_redirect_update_3 hook_update #3
taxonomy_redirect_update_4 hook_update #4