multiple_email.install in Multiple E-mail Addresses 5
Same filename and directory in other branches
Install file for multiple_email module
File
multiple_email.installView source
<?php
/**
* @file
* Install file for multiple_email module
*/
/**
* Implementation of hook_install()
*/
function multiple_email_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("\n CREATE TABLE {multiple_email} (\n eid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n uid int(10) UNSIGNED NOT NULL,\n email varchar(255) NOT NULL,\n time_registered int(11) UNSIGNED NOT NULL,\n confirmed tinyint(1) NOT NULL,\n confirm_code varchar(255) NOT NULL,\n time_code_generated int(11) UNSIGNED NOT NULL,\n attempts tinyint(1) UNSIGNED NOT NULL DEFAULT 0,\n PRIMARY KEY (eid),\n INDEX uid (uid),\n INDEX email (email)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;\n ");
break;
case 'pgsql':
// Someone should write this...?
break;
}
// Now import current users' emails
db_query("\n INSERT INTO {multiple_email}\n (uid, email, time_registered, confirmed)\n SELECT\n uid,\n mail,\n created,\n IF(login, 1, 0)\n FROM {users}\n WHERE uid != 0\n ");
}
/**
* Implementation of hook_uninstall()
*/
function multiple_email_uninstall() {
db_query('DROP TABLE {multiple_email}');
}
Functions
Name | Description |
---|---|
multiple_email_install | Implementation of hook_install() |
multiple_email_uninstall | Implementation of hook_uninstall() |