home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / drupal-6.0.exe / drupal-6.0 / modules / upload / upload.install < prev    next >
Encoding:
Text File  |  2008-02-08  |  2.3 KB  |  86 lines

  1. <?php
  2. // $Id: upload.install,v 1.6.2.1 2008/02/08 18:01:14 goba Exp $
  3.  
  4. /**
  5.  * Implementation of hook_install().
  6.  */
  7. function upload_install() {
  8.   // Create table. The upload table might have been created in the Drupal 5
  9.   // to Drupal 6 upgrade, and was migrated from the file_revisions table. So
  10.   // in this case, there is no need to create the table, it is already there.
  11.   if (!db_table_exists('upload')) {
  12.     drupal_install_schema('upload');
  13.   }
  14. }
  15.  
  16. /**
  17.  * Implementation of hook_uninstall().
  18.  */
  19. function upload_uninstall() {
  20.   // Remove tables.
  21.   drupal_uninstall_schema('upload');
  22. }
  23.  
  24. /**
  25.  * Implementation of hook_schema().
  26.  */
  27. function upload_schema() {
  28.   $schema['upload'] = array(
  29.     'description' => t('Stores uploaded file information and table associations.'),
  30.     'fields' => array(
  31.       'fid' => array(
  32.         'type' => 'int',
  33.         'unsigned' => TRUE,
  34.         'not null' => TRUE,
  35.         'default' => 0,
  36.         'description' => t('Primary Key: The {files}.fid.'),
  37.       ),
  38.       'nid' => array(
  39.         'type' => 'int',
  40.         'unsigned' => TRUE,
  41.         'not null' => TRUE,
  42.         'default' => 0,
  43.         'description' => t('The {node}.nid associated with the uploaded file.'),
  44.       ),
  45.       'vid' => array(
  46.         'type' => 'int',
  47.         'unsigned' => TRUE,
  48.         'not null' => TRUE,
  49.         'default' => 0,
  50.         'description' => t('Primary Key: The {node}.vid associated with the uploaded file.'),
  51.       ),
  52.       'description' => array(
  53.         'type' => 'varchar',
  54.         'length' => 255,
  55.         'not null' => TRUE,
  56.         'default' => '',
  57.         'description' => t('Description of the uploaded file.'),
  58.       ),
  59.       'list' => array(
  60.         'type' => 'int',
  61.         'unsigned' => TRUE,
  62.         'not null' => TRUE,
  63.         'default' => 0,
  64.         'size' => 'tiny',
  65.         'description' => t('Whether the file should be visibly listed on the node: yes(1) or no(0).'),
  66.       ),
  67.       'weight' => array(
  68.         'type' => 'int',
  69.         'not null' => TRUE,
  70.         'default' => 0,
  71.         'size' => 'tiny',
  72.         'description' => t('Weight of this upload in relation to other uploads in this node.'),
  73.       ),
  74.     ),
  75.     'primary key' => array('vid', 'fid'),
  76.     'indexes' => array(
  77.       'fid' => array('fid'),
  78.       'nid' => array('nid'),
  79.     ),
  80.   );
  81.  
  82.   return $schema;
  83. }
  84.  
  85.  
  86.