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

jcnventura's avatar
jcnventura committed
4 5
/**
 * @file
jcnventura's avatar
jcnventura committed
6
 * Install, update and uninstall functions for 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() {
15 16
  $t = get_t();
  drupal_set_message($t('Printer-friendly Page settings are available under !link',
17
    array( '!link' => l($t('Administer > Configuration > Printer, e-mail and PDF versions'),  'admin/config/print' ) )
jcnventura's avatar
jcnventura committed
18 19 20
  ));
}

jcnventura's avatar
jcnventura committed
21
/**
22
 * Implements hook_uninstall().
jcnventura's avatar
jcnventura committed
23 24 25 26 27 28
 */
function print_uninstall() {
  variable_del('print_settings');
  variable_del('print_sourceurl_settings');
  variable_del('print_html_settings');
  variable_del('print_robot_settings');
29
  variable_del('print_logo_url');
30
  variable_del('print_logo_options');
31 32
  variable_del('print_css');
  variable_del('print_urls');
33
  variable_del('print_urls_anchors');
34 35 36 37 38 39
  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');
40
  variable_del('print_html_link_pos');
41
  variable_del('print_html_link_teaser');
42 43 44 45 46 47 48 49
  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');
50
  variable_del('print_html_windowclose');
51 52 53
  variable_del('print_robots_noindex');
  variable_del('print_robots_nofollow');
  variable_del('print_robots_noarchive');
jcnventura's avatar
jcnventura committed
54 55 56 57 58 59 60 61 62 63
  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
64
  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
jcnventura's avatar
jcnventura committed
65
  foreach ($settings as $variable) {
jcnventura's avatar
jcnventura committed
66 67 68
    variable_del($variable->name);
  }
}
69 70

/**
71
 * Implements hook_schema().
72
 */
jcnventura's avatar
jcnventura committed
73 74
function print_schema() {
  $schema['print_node_conf'] = array(
jcnventura's avatar
jcnventura committed
75
    'description' => 'Printer-friendly version node-specific configuration settings',
jcnventura's avatar
jcnventura committed
76 77 78 79 80
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
81
        'description' => 'The {node}.nid of the node.',
jcnventura's avatar
jcnventura committed
82 83 84 85 86
      ),
      'link' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
87
        'default' => 1,
jcnventura's avatar
jcnventura committed
88
        'size' => 'tiny',
jcnventura's avatar
jcnventura committed
89
        'description' => 'Show link',
jcnventura's avatar
jcnventura committed
90 91 92 93 94
      ),
      'comments' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
95
        'default' => 1,
jcnventura's avatar
jcnventura committed
96
        'size' => 'tiny',
jcnventura's avatar
jcnventura committed
97
        'description' => 'Show link in individual comments',
jcnventura's avatar
jcnventura committed
98 99 100 101 102
      ),
      'url_list' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
103
        'default' => 1,
jcnventura's avatar
jcnventura committed
104
        'size' => 'tiny',
jcnventura's avatar
jcnventura committed
105
        'description' => 'Show Printer-friendly URLs list',
jcnventura's avatar
jcnventura committed
106 107 108 109
      ),
    ),
    'primary key' => array('nid'),
  );
110

jcnventura's avatar
jcnventura committed
111
  $schema['print_page_counter'] = array(
jcnventura's avatar
jcnventura committed
112
    'description' => 'Printer-friendly version access counter',
jcnventura's avatar
jcnventura committed
113 114 115 116 117
    'fields' => array(
      'path' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
jcnventura's avatar
jcnventura committed
118
        'description' => 'Page path',
jcnventura's avatar
jcnventura committed
119 120 121 122 123 124 125
      ),
      'totalcount' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'big',
jcnventura's avatar
jcnventura committed
126
        'description' => 'Number of page accesses',
jcnventura's avatar
jcnventura committed
127 128 129 130 131 132
      ),
      'timestamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
jcnventura's avatar
jcnventura committed
133
        'description' => 'Last access',
jcnventura's avatar
jcnventura committed
134 135 136 137
      ),
    ),
    'primary key' => array('path'),
  );
jcnventura's avatar
jcnventura committed
138

jcnventura's avatar
jcnventura committed
139
  return $schema;
jcnventura's avatar
jcnventura committed
140
}