page_title.install 1.26 KB
Newer Older
1
<?php
JohnAlbin's avatar
JohnAlbin committed
2
// $Id$
3

4 5 6
/**
 * Implementation of hook_install().
 */
7 8 9 10 11 12 13 14 15 16
function page_title_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $query1 = db_query("CREATE TABLE IF NOT EXISTS {page_title} (
                            nid INT NOT NULL,
                            page_title VARCHAR( 128 ) NOT NULL,
                            PRIMARY KEY ( `nid` )
                          ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
      if ($query1) {
JohnAlbin's avatar
JohnAlbin committed
17 18
        $created = TRUE;
      }
19 20 21 22 23 24 25 26
      break;

    case 'pgsql':
      $query1 = db_query("CREATE TABLE {page_title} (
                            nid integer NOT NULL default '0',
                            page_title text NOT NULL default ''
                          );");
      if ($query1) {
JohnAlbin's avatar
JohnAlbin committed
27 28
        $created = TRUE;
      }
29 30 31 32 33 34 35 36 37 38
      break;
  }

  if ($created) {
    drupal_set_message(t('Page title module installed successfully.'));
  }
  else {
    drupal_set_message(t('Table installation for the Page title module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries.'), 'error');
  }
}
JohnAlbin's avatar
JohnAlbin committed
39 40 41 42 43

/**
 * Implementation of hook_uninstall().
 */
function page_title_uninstall() {
JohnAlbin's avatar
JohnAlbin committed
44
  db_query('DROP TABLE {page_title}');
JohnAlbin's avatar
JohnAlbin committed
45
}