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

Contents of /contributions/modules/restrict_by_ip/restrict_by_ip.install

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


Revision 1.6 - (show annotations) (download) (as text)
Wed Mar 25 01:45:28 2009 UTC (8 months ago) by peligrorice
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-BETA2, HEAD
Changes since 1.5: +50 -47 lines
File MIME type: text/x-php
Attempt at initial 6.x Beta release
1 <?php
2 // $Id: restrict_by_ip.install,v 1.5 2008/02/25 20:49:28 peligrorice Exp $
3
4 /**
5 * Implementation of hook_install().
6 * Creates a table of the variables that will be needed to use this module
7 */
8 function restrict_by_ip_install() {
9 $ret = drupal_install_schema('restrict_by_ip');
10
11 $failed = array();
12 foreach ($ret as $query) {
13 if (!$query['success']) {
14 $failed[] = $query['query'];
15 }
16 }
17 if (empty($failed)) {
18 drupal_set_message(t('Restrict Logon By IP module installed successfully.'));
19 }
20 else {
21 drupal_set_message(t('Table installation for the Restrict Logon By IP module was unsuccessful. The following queries failed: !queries', array('!queries' => theme('item_list', $failed))), 'error');
22 }
23 }
24
25 /**
26 * Implementation of hook_schema().
27 */
28 function restrict_by_ip_schema() {
29 $schema['restrict_by_ip'] = array(
30 'description' => t('The Restrict By IP Table'),
31 'fields' => array(
32 'uid' => array(
33 'type' => 'int',
34 'not null' => TRUE,
35 'unsigned' => TRUE
36 ),
37 'restrict_by_ip_type' => array(
38 'type' => 'int',
39 'not null' => TRUE,
40 'unsigned' => TRUE
41 ),
42 'restrict_by_ip_address' => array(
43 'type' => 'varchar',
44 'length' => 128,
45 ),
46 ),
47 'primary key' => array('uid'),
48 );
49 return $schema;
50 }
51
52 /**
53 * Implementation of hook_uninstall().
54 */
55 function restrict_by_ip_uninstall() {
56 drupal_uninstall_schema('restrict_by_ip');
57 // Drop variables.
58 $variables = array(
59 'restrict_by_ip_user_registration',
60 );
61 foreach ($variables as $variable) {
62 variable_del($variable);
63 }
64 drupal_set_message(t('Restrict Logon By IP module uninstalled successfully.'));
65 }

  ViewVC Help
Powered by ViewVC 1.1.2