function browscap_install in Browscap 5
Same name and namespace in other branches
- 8.3 browscap.install \browscap_install()
- 8 browscap.install \browscap_install()
- 6.2 browscap.install \browscap_install()
- 6 browscap.install \browscap_install()
- 7 browscap.install \browscap_install()
Implementation of hook_install()
File
- ./
browscap.install, line 8
Code
function browscap_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$queries = db_query("CREATE TABLE {browscap} (\n useragent varchar(255) NOT NULL default '',\n `data` longblob NOT NULL,\n PRIMARY KEY (useragent)\n ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
$queries &= db_query("CREATE TABLE {browscap_statistics} (\n parent VARCHAR(255) NOT NULL,\n counter INT DEFAULT '0' NOT NULL,\n is_crawler TINYINT(1) DEFAULT '0' NOT NULL,\n PRIMARY KEY (parent)\n ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
$queries &= db_query("CREATE TABLE {cache_browscap} (\n cid varchar(255) NOT NULL default '',\n `data` longblob,\n expire int(11) NOT NULL default '0',\n created int(11) NOT NULL default '0',\n headers text,\n PRIMARY KEY (cid),\n KEY expire (expire)\n ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
if ($queries) {
drupal_set_message(t('Browscap tables installed into the database'));
}
else {
drupal_set_message(t('There was a problem installing the Browscap tables.'), 'error');
}
break;
case 'pgsql':
// This space available...
break;
}
}