You are here

function nodewords_install in Nodewords: D6 Meta Tags 5

Same name and namespace in other branches
  1. 6.3 nodewords.install \nodewords_install()
  2. 6 nodewords.install \nodewords_install()
  3. 6.2 nodewords.install \nodewords_install()

Implementation of hook_install().

File

./nodewords.install, line 6

Code

function nodewords_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret = db_query("CREATE TABLE {nodewords} (\n        type varchar(16) NOT NULL,\n        id varchar(255) NOT NULL,\n        name varchar(32) NOT NULL,\n        content text NULL,\n        PRIMARY KEY(type, id, name)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    case 'pgsql':
      $ret = db_query("CREATE TABLE {nodewords} (\n        type varchar(16) NOT NULL,\n        id varchar(255) NOT NULL,\n        name varchar(32) NOT NULL,\n        content text NULL,\n        PRIMARY KEY(type, id, name)\n        )");
      break;
  }
  if ($ret) {
    drupal_set_message(t('Meta tags module installed succesfully.'));
  }
  else {
    drupal_set_message(t('Meta tags module installation was unsuccesfull. The necessary database table may be created by hand. See the "README.txt" file in the "nodewords/" modules directory for instructions.', 'error'));
  }

  // Set the weight of the module
  db_query("UPDATE {system} SET weight = 10 WHERE name = 'nodewords'");
  return $ret;
}