[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/form_builder/ -> form_builder.install (source)

   1  <?php
   2  
   3  /**
   4   * Implementation of hook_install().
   5   */
   6  function form_builder_install() {
   7    drupal_install_schema('form_builder');
   8  }
   9  
  10  /**
  11   * Implementation of hook_uninstall().
  12   */
  13  function form_builder_uninstall() {
  14    drupal_uninstall_schema('form_builder');
  15    $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'form_builder_%'");
  16    while ($row = db_fetch_object($result)) {
  17      variable_del($row->name);
  18    }
  19  }
  20  
  21  /**
  22   * Implementation of hook_requirements().
  23   */
  24  function form_builder_requirements($phase) {
  25    $requirements = array();
  26    $t = get_t();
  27    if ($phase == 'runtime') {
  28      $form_builder_types = module_invoke_all('form_builder_types');
  29      if (empty($form_builder_types)) {
  30        $requirements['form_builder_types']['title'] = $t('Form builder');
  31        $requirements['form_builder_types']['severity'] = REQUIREMENT_ERROR;
  32        $requirements['form_builder_types']['description'] = t('Form builder module is installed but no modules implement support for it. You may want to disable Form builder module until it is needed.');
  33      }
  34    }
  35  
  36    return $requirements;
  37  }
  38  
  39  /**
  40   * Implementation of hook_schema().
  41   */
  42  function form_builder_schema() {
  43    $schema = array();
  44  
  45    $schema['form_builder_cache'] = array(
  46      'fields' => array(
  47        'sid' => array(
  48          'type' => 'varchar',
  49          'length' => '64',
  50          'not null' => FALSE,
  51          ),
  52        'form_id' => array(
  53          'type' => 'varchar',
  54          'length' => '128',
  55          'not null' => FALSE,
  56        ),
  57        'type' => array(
  58            'type' => 'varchar',
  59            'length' => '32',
  60            'not null' => FALSE,
  61        ),
  62        'updated' => array(
  63          'type' => 'int',
  64          'unsigned' => TRUE,
  65          'not null' => TRUE,
  66          'default' => 0,
  67          'disp-width' => '10',
  68        ),
  69        'data' => array(
  70          'type' => 'blob',
  71          'not null' => FALSE,
  72          'size' => 'big',
  73        ),
  74      ),
  75      'indexes' => array(
  76         'sid_obj_name' => array('sid', 'type', 'form_id'),
  77         'updated' => array('updated'),
  78      ),
  79    );
  80  
  81    return $schema;
  82  }
  83  
  84  /**
  85   * Change the {form_builder_cache} table to use a 'longblob' data column.
  86   */
  87  function form_builder_update_6000() {
  88    $ret = array();
  89    $spec = array(
  90      'type' => 'blob',
  91      'not null' => FALSE,
  92      'size' => 'big',
  93    );
  94    db_change_field($ret, 'form_builder_cache', 'data', 'data', $spec);
  95    return $ret;
  96  }
  97  
  98  /**
  99   * Change the {form_builder_cache} table to use a longer form_id column.
 100   */
 101  function form_builder_update_6001() {
 102    $ret = array();
 103    $spec = array(
 104      'type' => 'varchar',
 105      'length' => '128',
 106      'not null' => FALSE,
 107    );
 108    db_change_field($ret, 'form_builder_cache', 'form_id', 'form_id', $spec);
 109    return $ret;
 110  }


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