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

Diff of /contributions/modules/autoassignrole/autoassignrole.install

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

revision 1.7 by cyberswat, Tue Feb 12 17:27:58 2008 UTC revision 1.8 by cyberswat, Wed Aug 13 21:38:14 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: autoassignrole.install,v 1.7 2008/02/12 17:27:58 cyberswat Exp $
3    
4    /**
5     * @file
6     *
7     * The autoassignrole.install file
8     *
9     * Installs the {autoassignrole} table and inserts default data as well as
10     * provides uninstall functionality.
11     */
12    
13    /**
14     * Implementation of hook_install().
15     */
16    function autoassignrole_install() {
17      drupal_install_schema('autoassignrole');
18      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
19        'auto_roles', serialize(array())
20      );
21      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
22        'auto_active', 0
23      );
24      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
25        'user_active', 0
26      );
27      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
28        'user_roles', serialize(array())
29      );
30      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
31        'user_required', 0
32      );
33      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
34        'user_multiple', 0
35      );
36      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
37        'user_description', ''
38      );
39      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
40        'user_title', t("Role")
41      );
42      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
43        'user_fieldset_title', t("User Roles")
44      );
45      db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",
46        'user_sort', 'SORT_ASC'
47      );
48    }
49    
50  /**  /**
51   * Implementation of hook_uninstall().   * Implementation of hook_uninstall().
52   */   */
53  function autoassignrole_uninstall() {  function autoassignrole_uninstall() {
54          $vars = db_query("select name from variable where name like 'AUTOASSIGNROLE_%%'");    drupal_uninstall_schema('autoassignrole');
55          while ($var = db_fetch_object($vars)) {  }
56                  variable_del($var->name);  
57          }  /**
58     * Implementation of hook_schema().
59     */
60    function autoassignrole_schema() {
61      $schema['autoassignrole'] = array(
62        'description' => t('Stores challenge-specific information for challenge
63          nodes.'),
64        'fields' => array(
65          'arid'     => array(
66            'type' => 'varchar',
67            'length' => 38,
68            'not null' => TRUE,
69            'default' => '',
70            'description' => t('The id for this setting.'),
71          ),
72          'value' => array(
73            'type' => 'text',
74            'not null' => FALSE,
75            'default' => '',
76            'description' => t('The value for this setting.'),
77          ),
78        ),
79        'primary key' => array('arid'),
80      );
81      return $schema;
82  }  }
83    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.3