[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * Implementation of hook_install().
   5   */
   6  function blogapi_install() {
   7    // Create tables.
   8    drupal_install_schema('blogapi');
   9  }
  10  
  11  /**
  12   * Implementation of hook_uninstall().
  13   */
  14  function blogapi_uninstall() {
  15    // Remove tables.
  16    drupal_uninstall_schema('blogapi');
  17  }
  18  
  19  
  20  /**
  21   * Implementation of hook_schema().
  22   */
  23  function blogapi_schema() {
  24    //This table was introduced in Drupal 6.4
  25    $schema['blogapi_files'] = array(
  26      'description' => 'Stores information for files uploaded via the blogapi.',
  27      'fields' => array(
  28        'fid' => array(
  29          'description' => 'Primary Key: Unique file ID.',
  30          'type' => 'serial',
  31        ),
  32        'uid' => array(
  33          'description' => 'The {users}.uid of the user who is associated with the file.',
  34          'type' => 'int',
  35          'unsigned' => TRUE,
  36          'not null' => TRUE,
  37          'default' => 0),
  38        'filepath' => array(
  39          'description' => 'Path of the file relative to Drupal root.',
  40          'type' => 'varchar',
  41          'length' => 255,
  42          'not null' => TRUE,
  43          'default' => ''),
  44        'filesize' => array(
  45          'description' => 'The size of the file in bytes.',
  46          'type' => 'int',
  47          'unsigned' => TRUE,
  48          'not null' => TRUE,
  49          'default' => 0),
  50      ),
  51      'primary key' => array('fid'),
  52      'indexes' => array(
  53        'uid' => array('uid'),
  54      ),
  55    );
  56  
  57    return $schema;
  58  }
  59  
  60  /**
  61   * @defgroup updates-5.x-to-6.x Blog API updates from 5.x to 6.x
  62   * @{
  63   */
  64  
  65  /**
  66   * Inform users about the new permission.
  67   */
  68  function blogapi_update_6000() {
  69    drupal_set_message("Blog API module does not depend on blog module's permissions anymore, but provides its own 'administer content with blog api' permission instead. Until <a href=\"". url('admin/user/permissions', array('fragment' => 'module-blogapi')) .'">this permission is assigned</a> to at least one user role, only the site administrator will be able to use Blog API features.');
  70    return array();
  71  }
  72  
  73  
  74  /**
  75   * Add blogapi_files table to enable size restriction for BlogAPI file uploads.
  76   *
  77   * This table was introduced in Drupal 6.4.
  78   */
  79  function blogapi_update_6001() {
  80      $schema['blogapi_files'] = array(
  81      'description' => 'Stores information for files uploaded via the blogapi.',
  82      'fields' => array(
  83        'fid' => array(
  84          'description' => 'Primary Key: Unique file ID.',
  85          'type' => 'serial',
  86        ),
  87        'uid' => array(
  88          'description' => 'The {users}.uid of the user who is associated with the file.',
  89          'type' => 'int',
  90          'unsigned' => TRUE,
  91          'not null' => TRUE,
  92          'default' => 0),
  93        'filepath' => array(
  94          'description' => 'Path of the file relative to Drupal root.',
  95          'type' => 'varchar',
  96          'length' => 255,
  97          'not null' => TRUE,
  98          'default' => ''),
  99        'filesize' => array(
 100          'description' => 'The size of the file in bytes.',
 101          'type' => 'int',
 102          'unsigned' => TRUE,
 103          'not null' => TRUE,
 104          'default' => 0),
 105      ),
 106      'primary key' => array('fid'),
 107      'indexes' => array(
 108        'uid' => array('uid'),
 109      ),
 110    );
 111  
 112    $ret = array();
 113  
 114    if (!db_table_exists('blogapi_files')) {
 115      db_create_table($ret, 'blogapi_files', $schema['blogapi_files']);
 116    }
 117    return $ret;
 118  }
 119  
 120  /**
 121   * @} End of "defgroup updates-5.x-to-6.x"
 122   * The next series of updates should start at 7000.
 123   */
 124  


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