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

Contents of /contributions/modules/webcams/webcams.install

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


Revision 1.5 - (show annotations) (download) (as text)
Mon Dec 10 22:30:19 2007 UTC (23 months, 2 weeks ago) by moonray
Branch: MAIN
CVS Tags: DRUPAL-5--1-4, DRUPAL-5--1-3, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.4: +8 -1 lines
File MIME type: text/x-php
Added Thickbox module integration.
1 <?php
2 // $Id: webcams.install,v 1.4 2007/12/05 20:27:12 moonray Exp $
3
4 /**
5 * @file webcams.install
6 *
7 * Install and update hooks for webcams module
8 */
9
10 /**
11 * Implementation of hook_install()
12 */
13 function webcams_install() {
14 switch ($GLOBALS['db_type']) {
15 case 'mysql':
16 case 'mysqli':
17 db_query("CREATE TABLE {webcams} (
18 wid int(10) unsigned NOT NULL auto_increment,
19 nid int(10) unsigned NOT NULL default '0',
20 vid int(10) unsigned NOT NULL default '0',
21 name varchar(128) NOT NULL default '',
22 default_url varchar(255) NOT NULL default '',
23 url varchar(128) NOT NULL default '',
24 width int(4) unsigned NOT NULL default '0',
25 height int(4) unsigned NOT NULL default '0',
26 thickbox int(1) unsigned NOT NULL default '0',
27 link varchar(128) NOT NULL default '',
28 delay int(4) unsigned NOT NULL default '30',
29 timeout int(4) unsigned NOT NULL default '0',
30 weight tinyint NOT NULL default '0',
31 PRIMARY KEY (wid),
32 KEY nid (nid),
33 KEY vid (vid),
34 INDEX (weight)
35 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
36 break;
37 case 'pgsql':
38 drupal_set_message(t('Could not create tables for postgres. Add them manually.'), 'error');
39 break;
40 }
41 }
42
43 /**
44 * Implementation of hook_uninstall()
45 */
46 function webcams_uninstall() {
47 db_query('DROP TABLE {webcams}');
48 }
49
50 /**
51 * Implementation of hook_update()
52 */
53 function webcams_update_1() {
54 $ret = array();
55 $ret[] = update_sql("ALTER TABLE {webcams} ADD COLUMN timeout int(4) unsigned NOT NULL default '0' AFTER delay");
56 return $ret;
57 }
58
59 function webcams_update_2() {
60 $ret = array();
61 $ret[] = update_sql("UPDATE {permission} SET perm = REPLACE(perm, 'view webcams', 'access webcams') WHERE perm LIKE '%view webcams%'");
62 return $ret;
63 }
64
65 function webcams_update_3() {
66 $ret = array();
67 $ret[] = update_sql("ALTER TABLE {webcams} ADD COLUMN thickbox int(1) unsigned NOT NULL default '0' AFTER height");
68 return $ret;
69 }

  ViewVC Help
Powered by ViewVC 1.1.2