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

Contents of /contributions/modules/wowroster/wowroster.install

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


Revision 1.2 - (show annotations) (download) (as text)
Tue Nov 28 17:34:22 2006 UTC (2 years, 11 months ago) by mosh
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-4-7
Changes since 1.1: +4 -6 lines
File MIME type: text/x-php
fixed some t() errors
1 <?php
2 /**
3 * $Id: wowroster.install,v 1.1 2006/11/27 09:40:26 mosh Exp $
4 */
5
6
7
8 /**
9 * Implementation of hook_install()
10 */
11 function wowroster_install() {
12 // install wowroster_status table
13 switch ($GLOBALS['db_type']) {
14 case 'mysql':
15 case 'mysqli':
16 db_query('DROP TABLE IF EXISTS {wowroster_status}');
17 db_query('CREATE TABLE {wowroster_status} (
18 wowroster_is_installed INT(1) UNSIGNED DEFAULT "0",
19 PRIMARY KEY (wowroster_is_installed)
20 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;');
21 break;
22
23 case 'pgsql':
24 /*/
25 db_query('create table {wowroster_status} (
26 wowroster_is_installed integer default 0,
27 primary key (wowroster_is_installed)
28 );');
29 /**/
30 break;
31 }
32
33 // set WoWRoster as NOT installed in wowroster_status table
34 db_query("INSERT INTO {wowroster_status} SET wowroster_is_installed = 0");
35
36 // tell the user that the drupal-module has been setup.
37 drupal_set_message(t('wowroster module has been setup.'));
38
39 // check if db_url is properly setup
40 if (!is_array($GLOBALS['db_url'])) {
41 drupal_set_message(t('Your $db_url in settings.php is not set as an array.<br />Set your $db_url variable like this:<br /><br />$db_url[\'default\'] = mysql://user:pass@host/dbname<br />$db_url[\'wowroster\'] = mysql://user:pass@host/dbname'), 'error');
42 } else {
43 if (!$GLOBALS['db_url']['wowroster']) {
44 drupal_set_message(t('$db_url[\'wowroster\'] is not present in settings.php'), 'error');
45 }
46 }
47
48 // check if the WoWRoster package is present
49 if (!is_dir(drupal_get_path('module', 'wowroster').'/roster')) {
50 drupal_set_message(t('You have to unpack WoWRoster into').' '.drupal_get_path('module', 'wowroster').'/roster.<br />'.t('Then you should go to').' '.l('WoWRoster Installer', 'admin/wowroster/installer'), 'error');
51 } else {
52 // check if the WoWRoster package is installed
53 if (is_file(drupal_get_path('module', 'wowroster').'/roster/install.php')) {
54 drupal_set_message(t('WoWRoster is not installed. You should go to').' '.l('WoWRoster Installer', 'admin/wowroster/installer'), 'error');
55 }
56 }
57 }
58
59
60
61 /**
62 * Updates to wowroster
63 */
64 /*/
65 function wowroster_update_1() {
66 }
67 /**/
68 ?>

  ViewVC Help
Powered by ViewVC 1.1.2