You are here

function page_title_install in Page Title 5.2

Same name and namespace in other branches
  1. 5 page_title.install \page_title_install()
  2. 6.2 page_title.install \page_title_install()
  3. 6 page_title.install \page_title_install()
  4. 7 page_title.install \page_title_install()

Implementation of hook_install().

File

./page_title.install, line 11
The Page Title install file, which controls the installation and uninstallation (and updates) of the Page Title module.

Code

function page_title_install() {
  $result = FALSE;
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $result = db_query('CREATE TABLE {page_title} (
                             type VARCHAR(15) NOT NULL DEFAULT "node",
                             id INT NOT NULL DEFAULT 0,
                             page_title VARCHAR(255) NOT NULL,
                             PRIMARY KEY (type, id)
                           ) /*!40100 DEFAULT CHARACTER SET utf8 */;');
      break;
    case 'pgsql':
      $result = db_query('CREATE TABLE {page_title} (
                            type VARCHAR(15) DEFAULT "node" NOT NULL,
                            id INT NOT NULL,
                            page_title VARCHAR(255) NOT NULL,
                            PRIMARY KEY (type, id)
                          )');
      break;
  }
  if ($result) {
    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');
  }
}