radioactivity_node.install in Radioactivity 5
File
plugins/radioactivity_node.install
View source
<?php
function radioactivity_node_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {radioactivity_node_clicks} (\n nid int NOT NULL,\n uid int NOT NULL,\n remote_address VARCHAR(31) NOT NULL,\n click_timestamp int NOT NULL\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
db_query("CREATE INDEX {radioactivity_node_clicks_ix_nid_uid}\n ON {radioactivity_node_clicks} (nid, uid);");
db_query("CREATE INDEX {radioactivity_node_clicks_ix_nid_ip}\n ON {radioactivity_node_clicks} (nid, remote_address);");
break;
case 'pgsql':
db_query("CREATE TABLE {radioactivity_node_clicks} (\n nid int NOT NULL,\n uid int NOT NULL,\n remote_address VARCHAR(31) NOT NULL,\n click_timestamp int NOT NULL\n );");
db_query("CREATE INDEX {radioactivity_node_clicks}_ix_nid_uid\n ON {radioactivity_node_clicks} (nid, uid);");
db_query("CREATE INDEX {radioactivity_node_clicks}_ix_nid_ip\n ON {radioactivity_node_clicks} (nid, remote_address);");
break;
}
}
function radioactivity_node_uninstall() {
db_query("DROP TABLE {radioactivity_node_clicks}");
variable_del('radioactivity_node_click_duration');
if (db_table_exists('radioactivity')) {
db_query("DELETE FROM {radioactivity} WHERE class='node'");
}
}