You are here

function print_install in Printer, email and PDF versions 5.4

Same name and namespace in other branches
  1. 5.3 print.install \print_install()
  2. 6 print.install \print_install()
  3. 7.2 print.install \print_install()
  4. 7 print.install \print_install()
  5. 5.x print.install \print_install()

Implementation of hook_install().

File

./print.install, line 13
Install file of the print module

Code

function print_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {print_node_conf} (\n        nid int(10) unsigned NOT NULL,\n        link tinyint(3) unsigned NOT NULL default '1',\n        comments tinyint(3) unsigned NOT NULL default '1',\n        url_list tinyint(3) unsigned NOT NULL default '1',\n        PRIMARY KEY  (nid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {print_page_counter} (\n        path varchar(128) NOT NULL,\n        totalcount bigint(20) unsigned NOT NULL default '0',\n        timestamp int(10) unsigned NOT NULL default '0',\n        PRIMARY KEY  (path)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {print_node_conf} (\n        nid int_unsigned NOT NULL,\n        link smallint NOT NULL default '1',\n        comments smallint_unsigned NOT NULL default '1',\n        url_list smallint_unsigned NOT NULL default '1',\n        PRIMARY KEY  (nid)\n      )");
      db_query("CREATE TABLE {print_page_counter} (\n        path varchar(128) NOT NULL,\n        totalcount bigint NOT NULL default '0',\n        timestamp int_unsigned NOT NULL default '0',\n        PRIMARY KEY  (path)\n      )");
      break;
  }

  // Module weight
  db_query("UPDATE {system} SET weight = 0 WHERE name = 'print'");
  $t = get_t();
  drupal_set_message($t('Printer-friendly Page settings are available under !link', array(
    '!link' => l($t('Administer > Site configuration > Printer-friendly Pages'), 'admin/settings/print'),
  )));
}