download_count.install in Download Count 7.2
Same filename and directory in other branches
Installation code for the download_count module.
File
download_count.installView source
<?php
/**
* @file
* Installation code for the download_count module.
*/
/**
* Implements hook_schema().
*/
function download_count_schema() {
$schema['download_count'] = array(
'description' => 'TODO',
'fields' => array(
'dcid' => array(
'description' => 'Primary Key: Unique download count id.',
'type' => 'serial',
'not null' => TRUE,
),
'fid' => array(
'description' => 'The id from the drupal files table of the file downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'description' => 'The nid of the node to which the downloaded file was attached when it was downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'The uid of the user that downloaded the file.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'vid' => array(
'description' => 'The vid of the node revision to which the downloaded file was attached when it was downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'ip_address' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => NULL,
'description' => "The ip address of the downloading user.",
),
'referrer' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'Referrer URI.',
),
'timestamp' => array(
'description' => 'The date-time the file was downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'dcid',
),
);
return $schema;
}
/**
* Implements hook_install().
*/
function download_count_install() {
// TODO The drupal_(un)install_schema functions are called automatically in D7.
// drupal_install_schema('download_count')
}
/**
* Implements hook_uninstall().
*/
function download_count_uninstall() {
// TODO The drupal_(un)install_schema functions are called automatically in D7.
// drupal_uninstall_schema('download_count')
// TODO Please review the conversion of this statement to the D7 database API syntax.
/* db_query("DELETE FROM {variable} WHERE name LIKE 'download_count_%'") */
db_delete('variable')
->condition('name', 'download_count_%', 'LIKE')
->execute();
}
Functions
Name![]() |
Description |
---|---|
download_count_install | Implements hook_install(). |
download_count_schema | Implements hook_schema(). |
download_count_uninstall | Implements hook_uninstall(). |