summaryrefslogtreecommitdiffstats
path: root/print.install
blob: 87cf258cc20f35124554edb21d61a867ea03addf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php

/**
 * @file
 * Install, update and uninstall functions for the print module.
 *
 * @ingroup print
 */

/**
 * Implements hook_install().
 */
function print_install() {
  $t = get_t();
  drupal_set_message($t('Printer-friendly Page settings are available under !link',
    array( '!link' => l($t('Administer > Configuration > Printer, e-mail and PDF versions'),  'admin/config/user-interface/print' ) )
  ));
}

/**
 * Implements hook_enable().
 */
function print_enable() {
  $t = get_t();

  // Module weight
  db_update('system')
    ->fields(array(
      'weight' => 0,
    ))
    ->condition('type', 'module')
    ->condition('name', 'print')
    ->execute();
}

/**
 * Implements hook_uninstall().
 */
function print_uninstall() {
  variable_del('print_settings');
  variable_del('print_sourceurl_settings');
  variable_del('print_html_settings');
  variable_del('print_robot_settings');
  variable_del('print_logo_url');
  variable_del('print_logo_options');
  variable_del('print_css');
  variable_del('print_urls');
  variable_del('print_urls_anchors');
  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');
  variable_del('print_html_link_pos');
  variable_del('print_html_link_teaser');
  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');
  variable_del('print_html_windowclose');
  variable_del('print_robots_noindex');
  variable_del('print_robots_nofollow');
  variable_del('print_robots_noarchive');
  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_links');
  variable_del('print_text_published');
  variable_del('print_text_retrieved');
  variable_del('print_text_source_url');
  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
  foreach ($settings as $variable) {
    variable_del($variable->name);
  }
}

/**
 * Implements hook_schema().
 */
function print_schema() {
  $schema['print_node_conf'] = array(
    'description' => 'Printer-friendly version node-specific configuration settings',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The {node}.nid of the node.',
      ),
      'link' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
        'description' => 'Show link',
      ),
      'comments' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
        'description' => 'Show link in individual comments',
      ),
      'url_list' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
        'description' => 'Show Printer-friendly URLs list',
      ),
    ),
    'primary key' => array('nid'),
  );

  $schema['print_page_counter'] = array(
    'description' => 'Printer-friendly version access counter',
    'fields' => array(
      'path' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'description' => 'Page path',
      ),
      'totalcount' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'big',
        'description' => 'Number of page accesses',
      ),
      'timestamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Last access',
      ),
    ),
    'primary key' => array('path'),
  );

  return $schema;
}

/**
 * Remove hardcoded numeric deltas from all blocks
 */
function print_update_7000(&$sandbox) {
  $renamed_deltas = array(
    'print' => array(
      '0' => 'print-links',
      '1' => 'print-top',
    ),
  );

  update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
}