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

Contents of /contributions/modules/top_searches/top_searches.install

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


Revision 1.1 - (show annotations) (download) (as text)
Tue Jun 10 20:37:57 2008 UTC (17 months, 2 weeks ago) by zstolar
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-RC1, DRUPAL-6--1-0-RC2, DRUPAL-5--1-1, DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
File MIME type: text/x-php
Initial commit for the Top Searches module
1 <?php
2
3 function top_searches_install() {
4 switch ($GLOBALS['db_type']) {
5 case 'mysql':
6 case 'mysqli':
7 $query1 = db_query("
8 CREATE TABLE {top_searches} (
9 `qid` INT( 11 ) NOT NULL AUTO_INCREMENT ,
10 `q` VARCHAR( 255 ) NOT NULL ,
11 `counter` INT( 11 ) NULL DEFAULT '0',
12 PRIMARY KEY ( `qid` ),
13 UNIQUE KEY `q` (`q`)
14 )");
15
16 if ($query1) {
17 $created = TRUE;
18 }
19 break;
20 }
21 if ($created) {
22 drupal_set_message(t('Top searches module installed successfully.'));
23 }
24 else {
25 drupal_set_message(t('Table installation for the Top Searches module was unsuccessful. The tables may need to be installed by hand.'), 'error');
26 }
27 }
28
29 function top_searches_uninstall() {
30 switch ($GLOBALS['db_type']) {
31 case 'mysql':
32 case 'mysqli':
33 db_query("DROP TABLE {top_searches}");
34 db_query("DELETE FROM {variable} WHERE name LIKE 'top_searches%'");
35 cache_clear_all('variables', 'cache');
36 break;
37 }
38 }
39

  ViewVC Help
Powered by ViewVC 1.1.2