summaryrefslogtreecommitdiff
path: root/modules/forum/forum.install
blob: b63ea4c44372d26ae7ce46789a0b424f5e78ae88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
// $Id$

/**
 * Implementation of hook_install().
 */
function forum_install() {
  // Create the forum vocabulary. Assign the vocabulary a low weight so
  // it will appear first in forum topic create and edit forms.
  $vocabulary = array(
    'name' => t('Forums'),
    'multiple' => 0,
    'required' => 1,
    'hierarchy' => 1,
    'relations' => 0,
    'module' => 'forum',
    'weight' => -10,
    'nodes' => array('forum' => 1),
  );
  taxonomy_save_vocabulary($vocabulary);

  variable_set('forum_nav_vocabulary', $vocabulary['vid']);
}

/**
 * Remove forum table; forums now use the general term_node table to support multiple
 * node types.
 */
function forum_update_6001() {
  $ret = array();

  $ret[] = update_sql("DROP TABLE {forum}");

  return $ret;
}

/**
 * Implementation of hook_uninstall().
 */
function forum_uninstall() {
  $vid = variable_get('forum_nav_vocabulary', '');
  // Delete the vocabulary.
  taxonomy_del_vocabulary($vid);

  db_query("DELETE FROM {node} WHERE type = 'forum'");
  variable_del('forum_containers');
  variable_del('forum_nav_vocabulary');
  variable_del('forum_hot_topic');
  variable_del('forum_per_page');
  variable_del('forum_order');
  variable_del('forum_block_num_0');
  variable_del('forum_block_num_1');
}