You are here

subuser.install in Subuser 5

Same filename and directory in other branches
  1. 8 subuser.install
  2. 6 subuser.install
  3. 7.2 subuser.install

File

subuser.install
View source
<?php

// $Id
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'");
}

Functions