2006-07-13 13:14:25 +00:00
|
|
|
<?php
|
|
|
|
|
2009-05-13 19:42:18 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2012-08-07 19:49:48 +00:00
|
|
|
* Install and update functions for the Statistics module.
|
2009-05-13 19:42:18 +00:00
|
|
|
*/
|
|
|
|
|
2012-11-09 22:30:28 +00:00
|
|
|
/**
|
|
|
|
* Implements hook_uninstall().
|
|
|
|
*/
|
|
|
|
function statistics_uninstall() {
|
|
|
|
// Remove states.
|
2013-09-16 03:58:06 +00:00
|
|
|
\Drupal::state()->delete('statistics.node_counter_scale');
|
|
|
|
\Drupal::state()->delete('statistics.day_timestamp');
|
2012-11-09 22:30:28 +00:00
|
|
|
}
|
|
|
|
|
2007-10-05 14:43:26 +00:00
|
|
|
/**
|
2009-12-04 16:49:48 +00:00
|
|
|
* Implements hook_schema().
|
2007-10-05 14:43:26 +00:00
|
|
|
*/
|
|
|
|
function statistics_schema() {
|
2009-04-24 08:23:02 +00:00
|
|
|
$schema['node_counter'] = array(
|
|
|
|
'description' => 'Access statistics for {node}s.',
|
|
|
|
'fields' => array(
|
|
|
|
'nid' => array(
|
|
|
|
'description' => 'The {node}.nid for these statistics.',
|
|
|
|
'type' => 'int',
|
2012-10-04 20:27:03 +00:00
|
|
|
'unsigned' => TRUE,
|
2009-04-24 08:23:02 +00:00
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
|
|
|
),
|
|
|
|
'totalcount' => array(
|
|
|
|
'description' => 'The total number of times the {node} has been viewed.',
|
|
|
|
'type' => 'int',
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
|
|
|
'size' => 'big',
|
|
|
|
),
|
|
|
|
'daycount' => array(
|
|
|
|
'description' => 'The total number of times the {node} has been viewed today.',
|
|
|
|
'type' => 'int',
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
|
|
|
'size' => 'medium',
|
|
|
|
),
|
|
|
|
'timestamp' => array(
|
|
|
|
'description' => 'The most recent time the {node} has been viewed.',
|
|
|
|
'type' => 'int',
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'primary key' => array('nid'),
|
|
|
|
);
|
|
|
|
|
2007-10-05 14:43:26 +00:00
|
|
|
return $schema;
|
|
|
|
}
|