74 lines
1.8 KiB
Text
74 lines
1.8 KiB
Text
<?php
|
|
/**
|
|
* @file
|
|
* Recently read installation file.
|
|
* Displays a history of recently read nodes by currently logged in user.
|
|
*/
|
|
|
|
|
|
/**
|
|
* Implementation of hook_schema().
|
|
*/
|
|
function recently_read_schema() {
|
|
$schema['recently_read_nodes'] = array(
|
|
'description' => 'Table for history of read nodes',
|
|
'fields' => array(
|
|
'nid' => array(
|
|
'description' => 'The {node}.nid of the read node.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0
|
|
),
|
|
'type' => array(
|
|
'description' => 'The type of the read node.',
|
|
'type' => 'varchar',
|
|
'length' => 32,
|
|
'not null' => TRUE,
|
|
'default' => ''
|
|
),
|
|
'uid' => array(
|
|
'description' => 'The {user}.uid that read the node.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0
|
|
),
|
|
'timestamp' => array(
|
|
'description' => 'The time the node has been read.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0
|
|
),
|
|
'views' => array(
|
|
'description' => 'The number of times that the node has been read.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 1
|
|
)
|
|
),
|
|
'primary key' => array('nid', 'uid')
|
|
);
|
|
return $schema;
|
|
}
|
|
|
|
|
|
/**
|
|
* Implementation of hook_install().
|
|
*/
|
|
function recently_read_install() {
|
|
drupal_install_schema('recently_read');
|
|
}
|
|
|
|
|
|
/**
|
|
* Implementation of hook_uninstall().
|
|
*/
|
|
function recently_read_uninstall() {
|
|
drupal_uninstall_schema('recently_read');
|
|
variable_del('recently_read_node_types');
|
|
variable_del('recently_read_max_entries');
|
|
variable_del('recently_read_max_length');
|
|
}
|