/[drupal]/contributions/modules/pmetrics/pmetrics.install
ViewVC logotype

Contents of /contributions/modules/pmetrics/pmetrics.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Jul 2 20:10:13 2007 UTC (2 years, 4 months ago) by yaph
Branch: MAIN
CVS Tags: DRUPAL-5--1-0-DEV, HEAD
File MIME type: text/x-php
Initial commit of the pmetrics module for Drupal
1 <?php
2 /**
3 * $Id$
4 */
5
6 /**
7 * Implementation of hook_install().
8 */
9 function pmetrics_install() {
10 switch ($GLOBALS['db_type']) {
11 case 'mysql':
12 case 'mysqli':
13 $success = db_query("CREATE TABLE {pmetrics_cache} (
14 `cid` varchar(255) NOT NULL default '',
15 `data` longtext,
16 `expire` int(11) NOT NULL default '0',
17 `created` int(11) NOT NULL default '0',
18 `headers` text,
19 PRIMARY KEY (`cid`),
20 KEY `expire` (`expire`)
21 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
22 break;
23 case 'pgsql':
24 $success = db_query("CREATE TABLE {pmetrics_cache} (
25 `cid` varchar(255) NOT NULL default '',
26 `data` text,
27 `expire` int_unsigned NOT NULL default '0',
28 `created` int_unsigned NOT NULL default '0',
29 `headers` text,
30 PRIMARY KEY (`cid`)
31 )");
32 db_query("CREATE INDEX {pmetrics_cache}_expire_idx ON {pmetrics_cache} (expire)");
33 break;
34 }
35 if($success) {
36 drupal_set_message(t('The pmetrics table was installed successfully.'));
37 } else {
38 drupal_set_message(t('The pmetrics table was not installed.'));
39 }
40 }
41
42 /**
43 * Implementation of hook_uninstall().
44 */
45 function pmetrics_uninstall() {
46 db_query('DROP TABLE {pmetrics_cache}');
47 variable_del('pmetrics_site_id');
48 variable_del('pmetrics_site_key');
49 variable_del('pmetrics_cache_lifetime');
50 variable_del('pmetrics_tracking_code_type');
51 }
52 ?>

  ViewVC Help
Powered by ViewVC 1.1.2