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

Contents of /contributions/modules/wordfilter/wordfilter.install

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


Revision 1.4 - (show annotations) (download) (as text)
Tue Jun 19 12:13:44 2007 UTC (2 years, 5 months ago) by add1sun
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5
Changes since 1.3: +21 -3 lines
File MIME type: text/x-php
#110481 Upgrade to 5.  Thanks to metta, eaton and webchick.
1 <?php
2 // $Id$
3
4 /**
5 * Implementation of hook_install().
6 */
7 function wordfilter_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysql':
10 case 'mysqli':
11 $result = db_query("CREATE TABLE {wordfilter} (
12 id int(11) auto_increment,
13 words text NOT NULL,
14 replacement varchar(255) DEFAULT '' NOT NULL,
15 standalone tinyint(1) DEFAULT '0' NOT NULL,
16 PRIMARY KEY (id)
17 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
18 break;
19 case 'pgsql':
20 $result = db_query("CREATE TABLE {wordfilter} (
21 id serial PRIMARY KEY,
22 words text NOT NULL,
23 replacement varchar(255) DEFAULT '' NOT NULL,
24 standalone smallint DEFAULT '0' NOT NULL
25 );");
26 break;
27 }
28
29 if ($result) {
30 drupal_set_message(t("wordfilter module installed successfully."));
31 } else {
32 drupal_set_message(t("wordfilter module was not installed. Please view the wordfilter module folder and read the INSTALL.txt"), 'error');
33 }
34 }
35
36 /**
37 * Implementation of hook_update().
38 */
39 function wordfilter_update_1() {
40 return _system_update_utf8(array('wordfilter'));
41 }
42
43 function wordfilter_update_2() {
44 return array(update_sql("ALTER TABLE {wordfilter} CHANGE words words TEXT NOT NULL"));
45 }
46
47 /**
48 * Implementation of hook_uninstall().
49 */
50 function wordfilter_uninstall() {
51 db_query('DROP TABLE {wordfilter}');
52 }

  ViewVC Help
Powered by ViewVC 1.1.2