[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/modules/upload/ -> upload.install (source)

   1  <?php
   2  // $Id: upload.install,v 1.6.2.2 2009/01/06 15:46:38 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' => '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' => 'Primary Key: The {files}.fid.',
  37        ),
  38        'nid' => array(
  39          'type' => 'int',
  40          'unsigned' => TRUE,
  41          'not null' => TRUE,
  42          'default' => 0,
  43          'description' => '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' => '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' => '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' => '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' => '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  


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7