Issue #1098712: language negotiation constant warnings removed
[project/print.git] / print.install
1 <?php
2
3 /**
4 * @file
5 * Install, update and uninstall functions for the print module.
6 *
7 * @ingroup print
8 */
9
10 /**
11 * Implements hook_install().
12 */
13 function print_install() {
14 $t = get_t();
15 drupal_set_message($t('Printer-friendly Page settings are available under !link',
16 array( '!link' => l($t('Administer > Configuration > Printer, e-mail and PDF versions'), 'admin/config/user-interface/print' ) )
17 ));
18 }
19
20 /**
21 * Implements hook_enable().
22 */
23 function print_enable() {
24 $t = get_t();
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 /**
37 * Implements hook_uninstall().
38 */
39 function print_uninstall() {
40 variable_del('print_settings');
41 variable_del('print_sourceurl_settings');
42 variable_del('print_html_settings');
43 variable_del('print_robot_settings');
44 variable_del('print_logo_url');
45 variable_del('print_logo_options');
46 variable_del('print_css');
47 variable_del('print_urls');
48 variable_del('print_urls_anchors');
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');
55 variable_del('print_html_link_pos');
56 variable_del('print_html_link_teaser');
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');
65 variable_del('print_html_windowclose');
66 variable_del('print_robots_noindex');
67 variable_del('print_robots_nofollow');
68 variable_del('print_robots_noarchive');
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');
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');
77 $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
78 foreach ($settings as $variable) {
79 variable_del($variable->name);
80 }
81 }
82
83 /**
84 * Implements hook_schema().
85 */
86 function print_schema() {
87 $schema['print_node_conf'] = array(
88 'description' => 'Printer-friendly version node-specific configuration settings',
89 'fields' => array(
90 'nid' => array(
91 'type' => 'int',
92 'unsigned' => TRUE,
93 'not null' => TRUE,
94 'description' => 'The {node}.nid of the node.',
95 ),
96 'link' => array(
97 'type' => 'int',
98 'unsigned' => TRUE,
99 'not null' => TRUE,
100 'default' => 1,
101 'size' => 'tiny',
102 'description' => 'Show link',
103 ),
104 'comments' => array(
105 'type' => 'int',
106 'unsigned' => TRUE,
107 'not null' => TRUE,
108 'default' => 1,
109 'size' => 'tiny',
110 'description' => 'Show link in individual comments',
111 ),
112 'url_list' => array(
113 'type' => 'int',
114 'unsigned' => TRUE,
115 'not null' => TRUE,
116 'default' => 1,
117 'size' => 'tiny',
118 'description' => 'Show Printer-friendly URLs list',
119 ),
120 ),
121 'primary key' => array('nid'),
122 );
123
124 $schema['print_page_counter'] = array(
125 'description' => 'Printer-friendly version access counter',
126 'fields' => array(
127 'path' => array(
128 'type' => 'varchar',
129 'length' => 128,
130 'not null' => TRUE,
131 'description' => 'Page path',
132 ),
133 'totalcount' => array(
134 'type' => 'int',
135 'unsigned' => TRUE,
136 'not null' => TRUE,
137 'default' => 0,
138 'size' => 'big',
139 'description' => 'Number of page accesses',
140 ),
141 'timestamp' => array(
142 'type' => 'int',
143 'unsigned' => TRUE,
144 'not null' => TRUE,
145 'default' => 0,
146 'description' => 'Last access',
147 ),
148 ),
149 'primary key' => array('path'),
150 );
151
152 return $schema;
153 }
154
155 /**
156 * Remove hardcoded numeric deltas from all blocks
157 */
158 function print_update_7000(&$sandbox) {
159 $renamed_deltas = array(
160 'print' => array(
161 '0' => 'print-links',
162 '1' => 'print-top',
163 ),
164 );
165
166 update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
167 }