60 lines
1.4 KiB
Plaintext
60 lines
1.4 KiB
Plaintext
|
<?php
|
||
|
|
||
|
/**
|
||
|
* @file
|
||
|
* Install and update functions for the Statistics module.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Implements hook_uninstall().
|
||
|
*/
|
||
|
function statistics_uninstall() {
|
||
|
// Remove states.
|
||
|
\Drupal::state()->delete('statistics.node_counter_scale');
|
||
|
\Drupal::state()->delete('statistics.day_timestamp');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Implements hook_schema().
|
||
|
*/
|
||
|
function statistics_schema() {
|
||
|
$schema['node_counter'] = array(
|
||
|
'description' => 'Access statistics for {node}s.',
|
||
|
'fields' => array(
|
||
|
'nid' => array(
|
||
|
'description' => 'The {node}.nid for these statistics.',
|
||
|
'type' => 'int',
|
||
|
'unsigned' => TRUE,
|
||
|
'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'),
|
||
|
);
|
||
|
|
||
|
return $schema;
|
||
|
}
|