| 1 |
<?php
|
| 2 |
// $Id: netforum_authentication.install,v 1.2 2007/10/17 21:32:02 jamesmichaelhill Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install
|
| 6 |
*/
|
| 7 |
|
| 8 |
function netforum_authentication_install() {
|
| 9 |
// Drop module weight so we can override user paths
|
| 10 |
$weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'user'"));
|
| 11 |
db_query("UPDATE {system} SET weight = %d WHERE name = 'netforum_authentication'", $weight + 1);
|
| 12 |
|
| 13 |
switch ($GLOBALS['db_type']) {
|
| 14 |
case 'pgsql':
|
| 15 |
$success = FALSE;
|
| 16 |
break;
|
| 17 |
|
| 18 |
case 'mysql':
|
| 19 |
case 'mysqli':
|
| 20 |
|
| 21 |
db_query("ALTER TABLE {users} ADD (
|
| 22 |
cst_key varchar(36),
|
| 23 |
cst_type varchar(100),
|
| 24 |
cst_id varchar(10),
|
| 25 |
cst_web_password varchar(36)
|
| 26 |
);");
|
| 27 |
|
| 28 |
$success = TRUE;
|
| 29 |
break;
|
| 30 |
} // End case
|
| 31 |
|
| 32 |
// Notify of changes
|
| 33 |
if ($success) {
|
| 34 |
drupal_set_message(t('Netforum Authentication module installed tables successfully. Remember to visit the '. l(t('netforum settings'), 'admin/settings/netforum') .' before use.'));
|
| 35 |
}
|
| 36 |
else {
|
| 37 |
drupal_set_message(t('The installation of Netforum Authentication module was unsuccessful.'), 'error');
|
| 38 |
}
|
| 39 |
}
|
| 40 |
|
| 41 |
function netforum_authentication_uninstall() {
|
| 42 |
db_query("ALTER TABLE {users} DROP cst_key, cst_type, cst_id, cst_web_password");
|
| 43 |
variable_del('netforum_auth_user_register');
|
| 44 |
variable_del('netforum_auth_forgotten_password');
|
| 45 |
variable_del('netforum_auth_forgot_password_add');
|
| 46 |
variable_del('netforum_auth_user_editing');
|
| 47 |
variable_del('netforum_auth_eweb_sso');
|
| 48 |
variable_del('netforum_auth_cookie_domain');
|
| 49 |
variable_del('netforum_auth_sso_logout_url');
|
| 50 |
variable_del('netforum_auth_roles');
|
| 51 |
drupal_set_message(t('Netforum Authentication module has been successfully uninstalled.'));
|
| 52 |
}
|