| 1 |
<?php
|
| 2 |
// $Id: phpbbforum.install,v 1.3 2009/02/27 21:10:26 vb Exp $
|
| 3 |
/**
|
| 4 |
* Copyright (C) 2007-2008 by Vadim G.B. (http://vgb.org.ru)
|
| 5 |
*/
|
| 6 |
|
| 7 |
/**
|
| 8 |
* Implementation of hook_install().
|
| 9 |
*/
|
| 10 |
function phpbbforum_install() {
|
| 11 |
drupal_install_schema('phpbbforum');
|
| 12 |
}
|
| 13 |
|
| 14 |
/**
|
| 15 |
* Implementation of hook_uninstall().
|
| 16 |
*/
|
| 17 |
function phpbbforum_uninstall() {
|
| 18 |
|
| 19 |
drupal_uninstall_schema("phpbbforum");
|
| 20 |
|
| 21 |
// Delete all the phpbbforum variables and then clear the variable cache
|
| 22 |
|
| 23 |
$variables = array(
|
| 24 |
'phpbb_forum_title',
|
| 25 |
);
|
| 26 |
// Drop variables.
|
| 27 |
foreach ($variables as $variable) {
|
| 28 |
variable_del($variable);
|
| 29 |
}
|
| 30 |
|
| 31 |
db_query("DELETE FROM {variable} WHERE name LIKE 'phpbbforum_%'");
|
| 32 |
|
| 33 |
cache_clear_all('variables', 'cache');
|
| 34 |
|
| 35 |
drupal_set_message(t('phpBBforum module uninstalled successfully.'));
|
| 36 |
}
|
| 37 |
|
| 38 |
/**
|
| 39 |
* This update creates the table
|
| 40 |
* which is needed for the drupal2phpbb feature
|
| 41 |
*/
|
| 42 |
function phpbbforum_update_6000() {
|
| 43 |
|
| 44 |
$ret = array();
|
| 45 |
|
| 46 |
// New table to buffer mail messages during sending
|
| 47 |
db_create_table($ret, 'drupal2phpbb', _phpbbforum_schema_drupal2phpbb());
|
| 48 |
|
| 49 |
return $ret;
|
| 50 |
|
| 51 |
}
|
| 52 |
|
| 53 |
function phpbbforum_schema() {
|
| 54 |
$schema = array();
|
| 55 |
$schema['drupal2phpbb'] = _phpbbforum_schema_drupal2phpbb();
|
| 56 |
return $schema;
|
| 57 |
}
|
| 58 |
|
| 59 |
function _phpbbforum_schema_drupal2phpbb() {
|
| 60 |
|
| 61 |
$schema = array(
|
| 62 |
'description' => t('Mapping table for phpbbtopics created in via drupal'),
|
| 63 |
'fields' => array(
|
| 64 |
'node_id' => array(
|
| 65 |
'description' => t('References the drupal node id'),
|
| 66 |
'type' => 'int',
|
| 67 |
'unsigned' => TRUE,
|
| 68 |
'not null' => TRUE),
|
| 69 |
'topic_id' => array(
|
| 70 |
'description' => t('References the phpbb topic id'),
|
| 71 |
'type' => 'int',
|
| 72 |
'unsigned' => TRUE,
|
| 73 |
'not null' => TRUE),
|
| 74 |
'linked' => array(
|
| 75 |
'description' => t('Shall a comment-link be added to the node?'),
|
| 76 |
'type' => 'int',
|
| 77 |
'unsigned' => TRUE,
|
| 78 |
'not null' => TRUE)),
|
| 79 |
'primary key' => array('node_id', 'topic_id'),
|
| 80 |
);
|
| 81 |
|
| 82 |
return $schema;
|
| 83 |
}
|