remove themer bar image. not in use.
[project/devel.git] / devel.install
CommitLineData
48a80c07
GH
1<?php
2// $Id$
3/**
2c187dde 4 * @file
5 * Install file for devel module.
6 */
7
8/**
d422058c 9 * Implementation of hook_schema().
10 */
11function devel_schema() {
12 $schema['devel_queries'] = array(
13 'fields' => array(
14 'qid' => array('type' => 'serial', 'not null' => TRUE, 'disp-width' => '10'),
15 'function' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
16 'query' => array('type' => 'text', 'not null' => TRUE),
17 'hash' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '')),
18 'primary key' => array('hash'),
19 'indexes' => array(
20 'qid' => array('qid'))
21 );
22 $schema['devel_times'] = array(
23 'fields' => array(
24 'tid' => array('type' => 'serial', 'not null' => TRUE, 'disp-width' => '10'),
25 'qid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
26 'time' => array('type' => 'float', 'not null' => FALSE)),
27 'primary key' => array('tid'),
28 'indexes' => array(
29 'qid' => array('qid'))
30 );
31 return $schema;
32}
33
34 /**
48a80c07
GH
35 * Implementation of hook_install()
36 */
37function devel_install() {
d422058c 38 drupal_install_schema('devel');
39
9d450e49 40 // New module weights in core: put devel as the very last in the chain.
65c13c0a 41 db_query("UPDATE {system} SET weight = 88 WHERE name = 'devel'");
7cf0c0b5 42
fe9fe9e8 43 // Create our menu. See menu.install for an example.
7cf0c0b5 44 $t = get_t();
45 db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'devel', $t('Development'), $t('Development links.'));
9ba86bfd 46
47 $item = array(
48 'link_title' => 'Run cron',
49 'link_path' => 'admin/reports/status/run-cron',
50 'menu_name' => 'devel',
ad39dc66 51 'module' => 'devel',
9ba86bfd 52 );
53 menu_link_save($item);
fd5f044e 54
55 $item = array(
56 'link_title' => 'Devel settings',
57 'link_path' => 'admin/settings/devel',
58 'menu_name' => 'devel',
59 'module' => 'devel',
60 );
61 menu_link_save($item);
d422058c 62}
47fd09f8 63
d422058c 64 /**
32aec1ae 65 * Implementation of hook_uninstall().
d422058c 66 */
67function devel_uninstall() {
68 drupal_uninstall_schema('devel');
69 variable_del('dev_query');
70 variable_del('devel_old_smtp_library');
71 variable_del('devel_form_weights');
72 variable_del('devel_store_random');
73 variable_del('devel_execution');
74 variable_del('dev_timer');
75 variable_del('devel_query_display');
76 variable_del('devel_redirect_page');
77 variable_del('devel_api_url');
78 variable_del('dev_mem');
79 variable_del('devel_error_handler');
80 variable_del('devel_store_queries');
381442c2 81 variable_del('devel_switch_user_list_size');
82 variable_del('devel_switch_user_show_form');
dce879d9 83
84 db_query("DELETE FROM {menu_custom} WHERE menu_name = 'devel'");
ad39dc66 85 db_query("DELETE FROM {menu_links} WHERE module = 'devel'");
48a80c07
GH
86}
87
ca029ab6 88/**
89 * Implementation of hook_disable().
90 */
91function devel_disable() {
92 // Query logging should probably not be set if devel.module is disabled.
93 if (variable_get('dev_query', 0)) {
2c187dde 94 variable_set('dev_query', 0);
ca029ab6 95 drupal_set_message(t('Disabled query logging since devel module is disabled.'));
96 }
d422058c 97
98 // The SMTP server should also be restored.
99 variable_set('smtp_library', variable_get('devel_old_smtp_library', ''));
100 variable_del('devel_old_smtp_library');
101
102 // Same for storing queries
103 variable_del('devel_store_queries');
deeb3081 104
105 // Disable Devel Block
106 db_query("UPDATE {blocks} SET status = %d WHERE module = '%s' AND delta = '%s'", 0, 'menu', 'devel');
ca029ab6 107}
108
48a80c07 109/**
9d450e49 110 * Do update 1 again as the hook_install() was missing and new
48a80c07
GH
111 * installations are not having the weight set.
112 */
113function devel_update_2() {
9d450e49 114 // New module weights in core: put devel as the very last in the chain.
d422058c 115 $ret = array();
116 $ret[] = update_sql('UPDATE {system} SET weight = 10 WHERE name = "devel"');
48a80c07
GH
117 return $ret;
118}
cd1b6ba3 119
120function devel_update_3() {
121 switch ($GLOBALS['db_type']) {
122 case 'mysqli':
123 case 'mysql':
20079c18 124 $sql = "CREATE TABLE {devel_queries} (
4e736b5a 125 qid int(10) NOT NULL auto_increment,
126 query varchar(255) NOT NULL default '',
127 hash varchar(255) NOT NULL default '',
128 PRIMARY KEY (`hash`),
129 KEY qid (qid)
130 ) /*!40100 DEFAULT CHARACTER SET utf8 */;";
cd1b6ba3 131 $ret[] = update_sql($sql);
132
20079c18 133 $sql = "CREATE TABLE {devel_times} (
cd1b6ba3 134 tid int(10) NOT NULL auto_increment,
135 qid int(10) NOT NULL default 0,
136 time float default NULL,
137 PRIMARY KEY (tid),
138 KEY qid (qid)
139 ) /*!40100 DEFAULT CHARACTER SET utf8 */;";
140 $ret[] = update_sql($sql);
141 return $ret;
142 }
143}
20079c18
GK
144
145function devel_update_4() {
146 $ret = array();
d422058c 147
2c187dde 148 db_add_field($ret, 'devel_queries', 'function', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
d422058c 149
20079c18
GK
150 return $ret;
151}
39ba736c
GK
152
153function devel_update_5() {
154 $ret = array();
d422058c 155
2c187dde 156 db_change_field($ret, 'devel_queries', 'query', 'query text', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
d422058c 157
39ba736c
GK
158 return $ret;
159}
d46bda4d 160
fe9fe9e8 161function devel_update_6001() {
162 // Create our menu. See menu.install for an example.
4c0ce2b0 163 $ret[] = update_sql("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('devel', 'Development', 'Development links.')");
fe9fe9e8 164 return $ret;
165}
738fb016 166
167function devel_update_6002() {
168 $item = array(
169 'link_title' => 'Run cron',
170 'link_path' => 'admin/reports/status/run-cron',
171 'menu_name' => 'devel',
172 'module' => 'devel',
173 );
174 menu_link_save($item);
88289985 175 return array();
738fb016 176}
331db5ea 177
178/**
179 * As per issue #813132: change schablon.com to white for krumo.
180 */
181function devel_update_6003() {
182 if (variable_get('devel_krumo_skin', 'white') == 'schablon.com') {
183 variable_set('devel_krumo_skin', 'white');
184 }
73031d04 185 return array();
331db5ea 186}