[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

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

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


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7