function multiple_email_install in Multiple E-mail Addresses 5
Same name and namespace in other branches
- 6 multiple_email.install \multiple_email_install()
- 7 multiple_email.install \multiple_email_install()
- 2.x multiple_email.install \multiple_email_install()
Implementation of hook_install()
File
- ./
multiple_email.install, line 11 - Install file for multiple_email module
Code
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 ");
}