/[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.11 by cyberswat, Wed Sep 3 21:29:02 2008 UTC revision 1.12 by cyberswat, Fri Sep 25 16:08:43 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: autoassignrole.install,v 1.10 2008/09/03 16:40:12 cyberswat Exp $  // $Id: autoassignrole.install,v 1.7.2.14 2009/08/25 13:04:44 cyberswat Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 15  Line 15 
15   */   */
16  function autoassignrole_install() {  function autoassignrole_install() {
17    drupal_install_schema('autoassignrole');    drupal_install_schema('autoassignrole');
18    db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",    $sql = "INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')";
19      'auto_roles', serialize(array())    db_query($sql, 'auto_roles', serialize(array()));
20    );    db_query($sql, 'auto_active', 0);
21    db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",    db_query($sql, 'user_active', 0);
22      'auto_active', 0    db_query($sql, 'user_roles', serialize(array()));
23    );    db_query($sql, 'user_required', 0);
24    db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",    db_query($sql, 'user_multiple', 0);
25      'user_active', 0    db_query($sql, 'user_description', '');
26    );    db_query($sql, 'user_title', t("Role"));
27    db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",    db_query($sql, 'user_fieldset_title', t("User Roles"));
28      'user_roles', serialize(array())    db_query($sql, 'user_sort', 'SORT_ASC');
29    );    db_query($sql, 'user_selection', 2);
30    db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",    db_query($sql, 'page_active', 0);
31      'user_required', 0    db_query($sql, 'auto_admin_active', 0);
32    );    db_query($sql, 'node_user_register', '');
   db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",  
     'user_multiple', 0  
   );  
   db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",  
     'user_description', ''  
   );  
   db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",  
     'user_title', t("Role")  
   );  
   db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",  
     'user_fieldset_title', t("User Roles")  
   );  
   db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",  
     'user_sort', 'SORT_ASC'  
   );  
   db_query("INSERT into {autoassignrole} (arid,value) VALUES ('%s', '%s')",  
     'user_selection', 2  
   );  
33  }  }
34    
35  /**  /**
# Line 62  function autoassignrole_uninstall() { Line 44  function autoassignrole_uninstall() {
44   */   */
45  function autoassignrole_schema() {  function autoassignrole_schema() {
46    $schema['autoassignrole'] = array(    $schema['autoassignrole'] = array(
47      'description' => t('Stores challenge-specific information for challenge      'description' => t('Stores autoassignrole variables.'),
       nodes.'),  
48      'fields' => array(      'fields' => array(
49        'arid'     => array(        'arid'     => array(
50          'type' => 'varchar',          'type' => 'varchar',
# Line 75  function autoassignrole_schema() { Line 56  function autoassignrole_schema() {
56        'value' => array(        'value' => array(
57          'type' => 'text',          'type' => 'text',
58          'not null' => FALSE,          'not null' => FALSE,
         'default' => '',  
59          'description' => t('The value for this setting.'),          'description' => t('The value for this setting.'),
60        ),        ),
61      ),      ),
62      'primary key' => array('arid'),      'primary key' => array('arid'),
63    );    );
64      $schema['autoassignrole_page'] = array(
65        'description' => t('Stores autoassignrole page information.'),
66        'fields' => array(
67          'rid'     => array(
68            'type' => 'int',
69            'not null' => TRUE,
70            'description' => t('The rid for this page.'),
71          ),
72          'display' => array(
73            'type' => 'text',
74            'not null' => TRUE,
75            'description' => t('How to display the navigation to this page.'),
76          ),
77          'path' => array(
78            'type' => 'varchar',
79            'length' => 255,
80            'not null' => TRUE,
81            'description' => t('The path for this page.'),
82          ),
83          'menu' => array(
84            'type' => 'varchar',
85            'length' => 255,
86            'not null' => TRUE,
87            'description' => t('The default parent menu for this menu item.'),
88          ),
89          'title' => array(
90            'type' => 'text',
91            'not null' => TRUE,
92            'description' => t('The title for this page.'),
93          ),
94          'description' => array(
95            'type' => 'text',
96            'size' => 'big',
97            'not null' => FALSE,
98            'description' => t('The description for this page.'),
99          ),
100          'format' => array(
101            'type' => 'int',
102            'size' => 'tiny',
103            'not null' => FALSE,
104            'description' => t('The filter format to use on the description.'),
105          ),
106          'weight' => array(
107            'type' => 'int',
108            'size' => 'tiny',
109            'not null' => FALSE,
110            'default' => 0,
111            'description' => t('The weight of this item.'),
112          ),
113          'registration' => array(
114            'type' => 'int',
115            'size' => 'tiny',
116            'not null' => FALSE,
117            'default' => 0,
118            'description' => t('Should this item replace the default user registration page.'),
119          ),
120        ),
121        'primary key' => array('rid'),
122      );
123    return $schema;    return $schema;
124  }  }
125  function autoassignrole_update_6000() {  function autoassignrole_update_6000() {
# Line 95  function autoassignrole_update_6000() { Line 134  function autoassignrole_update_6000() {
134    autoassignrole_install();    autoassignrole_install();
135    return $items;    return $items;
136  }  }
137    
138    function autoassignrole_update_6001() {
139      $ret = array();
140    
141      // Rename the old contrib actions table if it exists so the contrib version
142      // of the module can do something with the old data.
143      if (!db_table_exists('autoassignrole_page')) {
144        $schema['autoassignrole_page'] = array(
145          'description' => t('Stores autoassignrole page information.'),
146          'fields' => array(
147            'rid'     => array(
148              'type' => 'int',
149              'not null' => TRUE,
150              'description' => t('The rid for this page.'),
151            ),
152            'display' => array(
153              'type' => 'text',
154              'not null' => TRUE,
155              'description' => t('How to display the navigation to this page.'),
156            ),
157            'path' => array(
158              'type' => 'varchar',
159              'length' => 255,
160              'not null' => TRUE,
161              'description' => t('The path for this page.'),
162            ),
163            'menu' => array(
164              'type' => 'varchar',
165              'length' => 255,
166              'not null' => TRUE,
167              'description' => t('The default parent menu for this menu item.'),
168            ),
169            'title' => array(
170              'type' => 'text',
171              'not null' => TRUE,
172              'description' => t('The title for this page.'),
173            ),
174            'description' => array(
175              'type' => 'text',
176              'size' => 'big',
177              'not null' => FALSE,
178              'description' => t('The description for this page.'),
179            ),
180            'format' => array(
181              'type' => 'int',
182              'size' => 'tiny',
183              'not null' => FALSE,
184              'description' => t('The filter format to use on the description.'),
185            ),
186            'weight' => array(
187              'type' => 'int',
188              'size' => 'tiny',
189              'not null' => FALSE,
190              'default' => 0,
191              'description' => t('The weight of this item.'),
192            ),
193            'registration' => array(
194              'type' => 'int',
195              'size' => 'tiny',
196              'not null' => FALSE,
197              'default' => 0,
198              'description' => t('Should this item replace the default user registration page.'),
199            ),
200          ),
201          'primary key' => array('rid'),
202        );
203    
204        db_create_table($ret, 'autoassignrole_page', $schema['autoassignrole_page']);
205      }
206    
207      return $ret;
208    }
209    
210    function autoassignrole_update_6002() {
211      $ret = array();
212      if (!db_column_exists('autoassignrole_page', 'menu')) {
213        $ret[] = update_sql('ALTER TABLE {autoassignrole_page} ADD menu VARCHAR(255)');
214      }
215      return $ret;
216    }
217    
218    function autoassignrole_update_6003() {
219      $ret = array();
220      if (!db_column_exists('autoassignrole_page', 'registration')) {
221        $ret[] = update_sql('ALTER TABLE {autoassignrole_page} ADD registration TINYINT default 0');
222      }
223      return $ret;
224    }
225    
226    function autoassignrole_update_6004() {
227      $value = db_fetch_object(db_query("SELECT arid FROM {autoassignrole} WHERE arid = '%s'", 'auto_admin_active'));
228      if (!$value->arid) {
229        $sql = "";
230        $ret[] = update_sql("INSERT into {autoassignrole} (arid,value) VALUES ('auto_admin_active', '0')");
231      }
232      return $ret;
233    }
234    function autoassignrole_update_6005() {
235      $value = db_fetch_object(db_query("SELECT arid FROM {autoassignrole} WHERE arid = '%s'", 'node_user_register'));
236      if (!$value->arid) {
237        $sql = "";
238        $ret[] = update_sql("INSERT into {autoassignrole} (arid,value) VALUES ('node_user_register', '')");
239      }
240      return $ret;
241    }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.3