You are here

function taxonomy_image_install in Taxonomy Image 5

Same name and namespace in other branches
  1. 6 taxonomy_image.install \taxonomy_image_install()

Implementation of hook_install().

File

./taxonomy_image.install, line 83
taxonomy_image.install Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.

Code

function taxonomy_image_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {term_image} (\n        tid int(10) unsigned NOT NULL,\n        path varchar(255) NOT NULL,\n        PRIMARY KEY (tid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {cache_tax_image} (\n        cid varchar(255) NOT NULL default '',\n        data longblob,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid),\n        INDEX expire (expire)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {term_image} (\n        tid integer NOT NULL default '0',\n        path varchar(255) NOT NULL,\n        PRIMARY KEY (tid)\n        )");
      db_query("CREATE TABLE {cache_tax_image} (\n        cid varchar(255) NOT NULL default '',\n        data bytea,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid)\n      )");
      break;
  }
  drupal_set_message(t('The Taxonomy Image module was installed. You may want to go to the <a href="!settings">settings page now</a>.', array(
    '!settings' => url('admin/settings/taxonomy_image'),
  )));
}