| 1 |
<?php
|
| 2 |
// $Id: fileapi.install,v 1.2 2008/06/18 12:04:57 dopry Exp $
|
| 3 |
|
| 4 |
function fileapi_install() {
|
| 5 |
drupal_install_schema('fileapi');
|
| 6 |
}
|
| 7 |
|
| 8 |
function fileapi_uninstall() {
|
| 9 |
drupal_uninstall_schema('fileapi');
|
| 10 |
}
|
| 11 |
|
| 12 |
|
| 13 |
function fileapi_enable() {
|
| 14 |
if (module_exists('backup_migrate')) {
|
| 15 |
// import fileapi data.
|
| 16 |
}
|
| 17 |
}
|
| 18 |
|
| 19 |
function fileapi_disable() {
|
| 20 |
if (module_exists('backup_migrate')) {
|
| 21 |
// export fileapi data
|
| 22 |
}
|
| 23 |
}
|
| 24 |
|
| 25 |
|
| 26 |
function fileapi_schema() {
|
| 27 |
$schema['fileapi_file'] = array(
|
| 28 |
'description' => t('Stores information for uploaded files.'),
|
| 29 |
'fields' => array(
|
| 30 |
'fid' => array(
|
| 31 |
'description' => t('Primary Key: Unique files ID.'),
|
| 32 |
'type' => 'serial',
|
| 33 |
'unsigned' => TRUE,
|
| 34 |
'not null' => TRUE,
|
| 35 |
),
|
| 36 |
'class' => array(
|
| 37 |
'description' => t('Name of the file.'),
|
| 38 |
'type' => 'varchar',
|
| 39 |
'length' => 255,
|
| 40 |
'not null' => TRUE,
|
| 41 |
'default' => 'fileapi_file',
|
| 42 |
),
|
| 43 |
'uid' => array(
|
| 44 |
'description' => t('The {users}.uid of the user who is associated with the file.'),
|
| 45 |
'type' => 'int',
|
| 46 |
'unsigned' => TRUE,
|
| 47 |
'not null' => TRUE,
|
| 48 |
'default' => 0,
|
| 49 |
),
|
| 50 |
'filename' => array(
|
| 51 |
'description' => t('Name of the file.'),
|
| 52 |
'type' => 'varchar',
|
| 53 |
'length' => 255,
|
| 54 |
'not null' => TRUE,
|
| 55 |
'default' => '',
|
| 56 |
),
|
| 57 |
'filepath' => array(
|
| 58 |
'description' => t('Stream reference to the file.'),
|
| 59 |
'type' => 'varchar',
|
| 60 |
'length' => 255,
|
| 61 |
'not null' => TRUE,
|
| 62 |
'default' => '',
|
| 63 |
),
|
| 64 |
'filemime' => array(
|
| 65 |
'description' => t('The file MIME type.'),
|
| 66 |
'type' => 'varchar',
|
| 67 |
'length' => 255,
|
| 68 |
'not null' => TRUE,
|
| 69 |
'default' => '',
|
| 70 |
),
|
| 71 |
'filesize' => array(
|
| 72 |
'description' => t('The size of the file in bytes.'),
|
| 73 |
'type' => 'int',
|
| 74 |
'unsigned' => TRUE,
|
| 75 |
'not null' => TRUE,
|
| 76 |
'default' => 0,
|
| 77 |
),
|
| 78 |
'permanent' => array(
|
| 79 |
'description' => t('A flag indicating whether file is temporary (0) or permanent (1).'),
|
| 80 |
'type' => 'int',
|
| 81 |
'not null' => TRUE,
|
| 82 |
'default' => 0,
|
| 83 |
),
|
| 84 |
'private' => array(
|
| 85 |
'description' => t('A flag indicating whether file is private (0) or permanent (1).'),
|
| 86 |
'type' => 'int',
|
| 87 |
'not null' => TRUE,
|
| 88 |
'default' => 0,
|
| 89 |
),
|
| 90 |
'timestamp' => array(
|
| 91 |
'description' => t('UNIX timestamp for when the file was added.'),
|
| 92 |
'type' => 'int',
|
| 93 |
'unsigned' => TRUE,
|
| 94 |
'not null' => TRUE,
|
| 95 |
'default' => 0,
|
| 96 |
),
|
| 97 |
),
|
| 98 |
'indexes' => array(
|
| 99 |
'uid' => array('uid'),
|
| 100 |
'permanent' => array('permanent'),
|
| 101 |
'private' => array('private'),
|
| 102 |
'timestamp' => array('timestamp'),
|
| 103 |
),
|
| 104 |
'primary key' => array('fid'),
|
| 105 |
);
|
| 106 |
return $schema;
|
| 107 |
}
|
| 108 |
|
| 109 |
|
| 110 |
|