print.install 3.5 KB
Newer Older
jcnventura's avatar
jcnventura committed
1 2 3
<?php
// $Id$

jcnventura's avatar
jcnventura committed
4 5 6
/**
 * @file
 * Install file of the print module
7 8
 *
 * @ingroup print
jcnventura's avatar
jcnventura committed
9 10
 */

jcnventura's avatar
jcnventura committed
11
/**
12
 * Implements hook_install().
jcnventura's avatar
jcnventura committed
13 14
 */
function print_install() {
jcnventura's avatar
jcnventura committed
15 16
  drupal_install_schema('print');

17 18
  $t = get_t();
  drupal_set_message($t('Printer-friendly Page settings are available under !link',
jcnventura's avatar
jcnventura committed
19
    array( '!link' => l($t('Administer > Site configuration > Printer-friendly Pages'),  'admin/settings/print' ) )
jcnventura's avatar
jcnventura committed
20 21 22
  ));
}

jcnventura's avatar
jcnventura committed
23
/**
24
 * Implements hook_uninstall().
jcnventura's avatar
jcnventura committed
25 26
 */
function print_uninstall() {
jcnventura's avatar
jcnventura committed
27 28
  drupal_uninstall_schema('print');

jcnventura's avatar
jcnventura committed
29 30 31 32
  variable_del('print_settings');
  variable_del('print_sourceurl_settings');
  variable_del('print_html_settings');
  variable_del('print_robot_settings');
33
  variable_del('print_logo_url');
34
  variable_del('print_logo_options');
35 36
  variable_del('print_css');
  variable_del('print_urls');
37
  variable_del('print_urls_anchors');
38 39 40 41 42 43
  variable_del('print_comments');
  variable_del('print_newwindow');
  variable_del('print_sourceurl_enabled');
  variable_del('print_sourceurl_date');
  variable_del('print_sourceurl_forcenode');
  variable_del('print_html_show_link');
44
  variable_del('print_html_link_pos');
45
  variable_del('print_html_link_teaser');
46 47 48 49 50 51 52 53
  variable_del('print_html_node_link_visibility');
  variable_del('print_html_node_link_pages');
  variable_del('print_html_link_class');
  variable_del('print_html_sys_link_visibility');
  variable_del('print_html_sys_link_pages');
  variable_del('print_html_book_link');
  variable_del('print_html_new_window');
  variable_del('print_html_sendtoprinter');
54
  variable_del('print_html_windowclose');
55 56 57
  variable_del('print_robots_noindex');
  variable_del('print_robots_nofollow');
  variable_del('print_robots_noarchive');
jcnventura's avatar
jcnventura committed
58 59 60 61 62 63 64 65 66 67
  variable_del('print_footer_options');
  variable_del('print_footer_user');
  variable_del('print_html_link_text');
  variable_del('print_html_link_use_alias');
  variable_del('print_text_by');
  variable_del('print_text_created');
  variable_del('print_text_links');
  variable_del('print_text_published');
  variable_del('print_text_retrieved');
  variable_del('print_text_source_url');
jcnventura's avatar
jcnventura committed
68
  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
jcnventura's avatar
jcnventura committed
69
  foreach ($settings as $variable) {
jcnventura's avatar
jcnventura committed
70 71 72
    variable_del($variable->name);
  }
}
73 74

/**
75
 * Implements hook_schema().
76
 */
jcnventura's avatar
jcnventura committed
77 78 79 80 81 82 83 84 85 86 87 88
function print_schema() {
  $schema['print_node_conf'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'link' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
89
        'default' => 1,
jcnventura's avatar
jcnventura committed
90 91 92 93 94 95
        'size' => 'tiny',
      ),
      'comments' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
96
        'default' => 1,
jcnventura's avatar
jcnventura committed
97 98 99 100 101 102
        'size' => 'tiny',
      ),
      'url_list' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
103
        'default' => 1,
jcnventura's avatar
jcnventura committed
104 105 106 107 108
        'size' => 'tiny',
      ),
    ),
    'primary key' => array('nid'),
  );
109

jcnventura's avatar
jcnventura committed
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
  $schema['print_page_counter'] = array(
    'fields' => array(
      'path' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'totalcount' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'big',
      ),
      'timestamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('path'),
  );
jcnventura's avatar
jcnventura committed
133

jcnventura's avatar
jcnventura committed
134
  return $schema;
jcnventura's avatar
jcnventura committed
135
}