Fix some notices when using wkhtmltopdf.
[project/print.git] / print.install
CommitLineData
b09f08f7 1<?php
b09f08f7
JV
2
3/**
3483245d 4 * @file
c12566f6 5 * Install, update and uninstall functions for the print module.
d08475b8
JV
6 *
7 * @ingroup print
3483245d
JV
8 */
9
10/**
937c5ab6 11 * Implements hook_install().
1e156b5a
JV
12 */
13function print_install() {
7d62e7c4
JV
14 $t = get_t();
15 drupal_set_message($t('Printer-friendly Page settings are available under !link',
e515a66b 16 array( '!link' => l($t('Administer > Configuration > Printer, e-mail and PDF versions'), 'admin/config/user-interface/print' ) )
1e156b5a
JV
17 ));
18}
19
20/**
befeb815
JV
21 * Implements hook_enable().
22 */
23function print_enable() {
cf29351e 24 $t = get_t();
befeb815
JV
25
26 // Module weight
27 db_update('system')
28 ->fields(array(
29 'weight' => 0,
30 ))
31 ->condition('type', 'module')
32 ->condition('name', 'print')
33 ->execute();
34}
35
36/**
937c5ab6 37 * Implements hook_uninstall().
b09f08f7
JV
38 */
39function print_uninstall() {
40 variable_del('print_settings');
b09f08f7
JV
41 variable_del('print_sourceurl_settings');
42 variable_del('print_html_settings');
43 variable_del('print_robot_settings');
7d62e7c4 44 variable_del('print_logo_url');
6df28242 45 variable_del('print_logo_options');
7d62e7c4
JV
46 variable_del('print_css');
47 variable_del('print_urls');
5e9a8d09 48 variable_del('print_urls_anchors');
7d62e7c4
JV
49 variable_del('print_comments');
50 variable_del('print_newwindow');
51 variable_del('print_sourceurl_enabled');
52 variable_del('print_sourceurl_date');
53 variable_del('print_sourceurl_forcenode');
54 variable_del('print_html_show_link');
6df28242 55 variable_del('print_html_link_pos');
23cc13e2 56 variable_del('print_html_link_teaser');
7d62e7c4
JV
57 variable_del('print_html_node_link_visibility');
58 variable_del('print_html_node_link_pages');
59 variable_del('print_html_link_class');
60 variable_del('print_html_sys_link_visibility');
61 variable_del('print_html_sys_link_pages');
62 variable_del('print_html_book_link');
63 variable_del('print_html_new_window');
64 variable_del('print_html_sendtoprinter');
b42d3086 65 variable_del('print_html_windowclose');
7d62e7c4
JV
66 variable_del('print_robots_noindex');
67 variable_del('print_robots_nofollow');
68 variable_del('print_robots_noarchive');
855b243a
JV
69 variable_del('print_footer_options');
70 variable_del('print_footer_user');
71 variable_del('print_html_link_text');
72 variable_del('print_html_link_use_alias');
855b243a
JV
73 variable_del('print_text_links');
74 variable_del('print_text_published');
75 variable_del('print_text_retrieved');
76 variable_del('print_text_source_url');
b09f08f7 77 $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
855b243a 78 foreach ($settings as $variable) {
b09f08f7
JV
79 variable_del($variable->name);
80 }
81}
7d62e7c4
JV
82
83/**
937c5ab6 84 * Implements hook_schema().
7d62e7c4 85 */
855b243a
JV
86function print_schema() {
87 $schema['print_node_conf'] = array(
c12566f6 88 'description' => 'Printer-friendly version node-specific configuration settings',
855b243a
JV
89 'fields' => array(
90 'nid' => array(
91 'type' => 'int',
92 'unsigned' => TRUE,
93 'not null' => TRUE,
c12566f6 94 'description' => 'The {node}.nid of the node.',
855b243a
JV
95 ),
96 'link' => array(
97 'type' => 'int',
98 'unsigned' => TRUE,
99 'not null' => TRUE,
a43c9735 100 'default' => 1,
855b243a 101 'size' => 'tiny',
c12566f6 102 'description' => 'Show link',
855b243a
JV
103 ),
104 'comments' => array(
105 'type' => 'int',
106 'unsigned' => TRUE,
107 'not null' => TRUE,
a43c9735 108 'default' => 1,
855b243a 109 'size' => 'tiny',
c12566f6 110 'description' => 'Show link in individual comments',
855b243a
JV
111 ),
112 'url_list' => array(
113 'type' => 'int',
114 'unsigned' => TRUE,
115 'not null' => TRUE,
a43c9735 116 'default' => 1,
855b243a 117 'size' => 'tiny',
c12566f6 118 'description' => 'Show Printer-friendly URLs list',
855b243a
JV
119 ),
120 ),
121 'primary key' => array('nid'),
122 );
7d62e7c4 123
855b243a 124 $schema['print_page_counter'] = array(
c12566f6 125 'description' => 'Printer-friendly version access counter',
855b243a
JV
126 'fields' => array(
127 'path' => array(
128 'type' => 'varchar',
129 'length' => 128,
130 'not null' => TRUE,
c12566f6 131 'description' => 'Page path',
855b243a
JV
132 ),
133 'totalcount' => array(
134 'type' => 'int',
135 'unsigned' => TRUE,
136 'not null' => TRUE,
137 'default' => 0,
138 'size' => 'big',
c12566f6 139 'description' => 'Number of page accesses',
855b243a
JV
140 ),
141 'timestamp' => array(
142 'type' => 'int',
143 'unsigned' => TRUE,
144 'not null' => TRUE,
145 'default' => 0,
c12566f6 146 'description' => 'Last access',
855b243a
JV
147 ),
148 ),
149 'primary key' => array('path'),
150 );
fabf1a53 151
855b243a 152 return $schema;
fabf1a53 153}
befeb815
JV
154
155/**
156 * Remove hardcoded numeric deltas from all blocks
157 */
158function print_update_7000(&$sandbox) {
159 $renamed_deltas = array(
160 'print' => array(
1d15b615
JV
161 '0' => 'print-links',
162 '1' => 'print-top',
befeb815
JV
163 ),
164 );
165
166 update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
167}