inactive_user.install in Inactive User 5
File
inactive_user.install
View source
<?php
function inactive_user_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {inactive_users} (\n uid int(10) unsigned NOT NULL default '0',\n notified_admin tinyint(1) unsigned NOT NULL default '0',\n notified_user tinyint(1) unsigned NOT NULL default '0',\n warned_user_block_timestamp int(11) unsigned NOT NULL default '0',\n notified_user_block tinyint(1) unsigned NOT NULL default '0',\n notified_admin_block tinyint(1) unsigned NOT NULL default '0',\n warned_user_delete_timestamp int(11) unsigned NOT NULL default '0',\n protected tinyint(1) unsigned NOT NULL default '0',\n PRIMARY KEY (uid)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
db_query("CREATE TABLE {inactive_users} (\n uid integer NOT NULL default '0',\n notified_admin smallint NOT NULL default '0',\n notified_user smallint NOT NULL default '0',\n warned_user_block_timestamp int_unsigned NOT NULL default '0',\n notified_user_block smallint NOT NULL default '0',\n notified_admin_block smallint NOT NULL default '0',\n warned_user_delete_timestamp int_unsigned NOT NULL default '0',\n protected smallint NOT NULL default '0',\n PRIMARY KEY (uid)\n );");
break;
}
}
function inactive_user_uninstall() {
db_query('DROP TABLE {inactive_users}');
variable_del('inactive_user_admin_email');
variable_del('inactive_user_auto_block');
variable_del('inactive_user_auto_block_warn');
variable_del('inactive_user_auto_delete');
variable_del('inactive_user_auto_delete_warn');
variable_del('inactive_user_block_notify_text');
variable_del('inactive_user_block_warn_text');
variable_del('inactive_user_delete_notify_text');
variable_del('inactive_user_delete_warn_text');
variable_del('inactive_user_notify');
variable_del('inactive_user_notify_admin');
variable_del('inactive_user_notify_block');
variable_del('inactive_user_notify_block_admin');
variable_del('inactive_user_notify_delete');
variable_del('inactive_user_notify_delete_admin');
variable_del('inactive_user_notify_text');
variable_del('inactive_user_preserve_content');
variable_del('inactive_user_timestamp');
}
function inactive_user_upgrade_5000() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {inactive_users} CHANGE uid uid INT(10) UNSIGNED NOT NULL DEFAULT '0'");
$ret[] = update_sql("ALTER TABLE {inactive_users} CHANGE notified_admin notified_user TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'");
$ret[] = update_sql("ALTER TABLE {inactive_users} CHANGE notified_user notified_user TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'");
$ret[] = update_sql("ALTER TABLE {inactive_users} CHANGE notified_user_block notified_user_block TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'");
$ret[] = update_sql("ALTER TABLE {inactive_users} CHANGE notified_admin_block notified_admin_block TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'");
$ret[] = update_sql("ALTER TABLE {inactive_users} CHANGE protected protected TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'");
break;
}
return $ret;
}