faq_ask.install in FAQ_Ask 6.2
Same filename and directory in other branches
This module is an add-on to the FAQ module that allows users with the 'ask question' permission to create a question which will be queued for an 'expert' to answer.
File
faq_ask.installView source
<?php
/**
* @file
* This module is an add-on to the FAQ module that allows users with the 'ask question'
* permission to create a question which will be queued for an 'expert' to answer.
*/
/**
* Implementation of hook_schema().
*/
function faq_ask_schema() {
$schema['faq_expert'] = array(
'description' => t('FAQ expert to term mapping.'),
'fields' => array(
'uid' => array(
'description' => t('User identifier for the expert.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'tid' => array(
'description' => t('Taxonomy identifier of the terms for the expert.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'uid',
'tid',
),
'indexes' => array(
'tid' => array(
'tid',
'uid',
),
),
);
$schema['faq_ask_notify'] = array(
'description' => t('FAQ node to asker mapping.'),
'fields' => array(
'nid' => array(
'description' => t('Node identifier for notification'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'email' => array(
'description' => t('Node identifier for notification'),
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
),
),
'primary key' => array(
'nid',
'email',
),
'indexes' => array(
'nid' => array(
'nid',
'email',
),
),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function faq_ask_install() {
$result = drupal_install_schema('faq_ask');
if (count($result) > 0) {
drupal_set_message(st('faq_ask module installed.'));
}
else {
drupal_set_message(st('faq_ask table creation failed. Please "uninstall" the module and retry.'));
}
}
/**
* Implementation of hook_update_N().
*/
function faq_ask_update_6100() {
$ret = array();
$ret[] = update_sql('INSERT INTO {faq_expert} (uid, tid) VALUES (' . variable_get('faq_ask_default_expert', 1) . ', 0)');
return $ret;
}
function faq_ask_update_6101() {
$ret = array();
$schema = faq_ask_schema();
db_create_table($ret, 'faq_ask_notify', $schema['faq_ask_notify']);
return $ret;
}
/**
* Implementation of hook_uninstall().
*/
function faq_ask_uninstall() {
drupal_uninstall_schema('faq_ask');
variable_del('faq_expert_role');
variable_del('faq_ask_vocabularies');
variable_del('faq_ask_title_len');
variable_del('faq_ask_suggest');
variable_del('faq_ask_notify');
variable_del('faq_ask_default_expert');
variable_del('faq_unanswered_count');
variable_del('faq_ask_expert_advice');
variable_del('faq_ask_help_text');
variable_del('faq_ask_categorize');
variable_del('faq_ask_expert_own');
variable_del('faq_ask_notify_asker');
variable_del('faq_ask_notify_asker_simplenews_tid');
variable_del('faq_ask_notify_asker_simplenews_confirm');
variable_del('faq_ask_notify_by_cron');
drupal_set_message(st('faq_ask module uninstalled.'));
}
Functions
Name | Description |
---|---|
faq_ask_install | Implementation of hook_install(). |
faq_ask_schema | Implementation of hook_schema(). |
faq_ask_uninstall | Implementation of hook_uninstall(). |
faq_ask_update_6100 | Implementation of hook_update_N(). |
faq_ask_update_6101 |