visitors.install in Visitors 7
Same filename and directory in other branches
Install/uninstall visitors module.
File
visitors.installView source
<?php
/* vim: set filetype=php: */
/**
* @file
* Install/uninstall visitors module.
*/
/**
* Implements hook_install().
*/
function visitors_install() {
variable_set('visitors_start_count_total_visitors', 0);
}
/**
* Uninstall the module with database table and module settings.
*/
function visitors_uninstall() {
drupal_uninstall_schema('visitors');
variable_del('visitors_exclude_administer_users');
variable_del('visitors_chart_height');
variable_del('visitors_chart_width');
variable_del('visitors_flush_log_timer');
variable_del('visitors_last_registered_user');
variable_del('visitors_lines_per_page');
variable_del('visitors_published_nodes');
variable_del('visitors_registered_user');
variable_del('visitors_show_total_visitors');
variable_del('visitors_show_unique_visitor');
variable_del('visitors_since_date');
variable_del('visitors_start_count_total_visitors');
variable_del('visitors_user_ip');
}
/**
* Implementats of hook_schema().
*/
function visitors_schema() {
$schema['visitors'] = array(
'fields' => array(
'visitors_id' => array(
'type' => 'serial',
'not null' => TRUE,
),
'visitors_uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'visitors_ip' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'visitors_date_time' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'visitors_url' => array(
'type' => 'text',
'not null' => TRUE,
),
'visitors_referer' => array(
'type' => 'text',
'not null' => TRUE,
),
'visitors_path' => array(
'type' => 'text',
'not null' => TRUE,
),
'visitors_title' => array(
'type' => 'text',
'not null' => TRUE,
),
'visitors_user_agent' => array(
'type' => 'text',
'not null' => TRUE,
),
),
'primary key' => array(
'visitors_id',
),
);
return $schema;
}
/**
* Change the visitors_title, visitors_path columns to type text.
*/
function visitors_update_7013() {
db_change_field('visitors', 'visitors_title', 'visitors_title', array(
'type' => 'text',
'not null' => TRUE,
));
db_change_field('visitors', 'visitors_path', 'visitors_path', array(
'type' => 'text',
'not null' => TRUE,
));
}
Functions
Name | Description |
---|---|
visitors_install | Implements hook_install(). |
visitors_schema | Implementats of hook_schema(). |
visitors_uninstall | Uninstall the module with database table and module settings. |
visitors_update_7013 | Change the visitors_title, visitors_path columns to type text. |