View source
<?php
function subuser_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query('CREATE TABLE {subuser} (
uid INT NOT NULL,
refuid INT NOT NULL,
PRIMARY KEY(uid)
) /*!40100 DEFAULT CHARACTER SET utf8 */;');
db_query("INSERT INTO {role} (name) VALUES ('%s')", "subuser");
variable_set("subuser_roleid", db_insert_id());
break;
case 'pgsql':
db_query('CREATE TABLE {subuser} (
uid INT NOT NULL,
refuid INT NOT NULL,
PRIMARY KEY(uid)
)');
break;
}
}
function subuser_uninstall() {
db_query('DROP TABLE {subuser}');
variable_del("subuser_roleid");
db_query("DELETE FROM {role} WHERE name='subuser'");
}