quizfileupload.install in Quiz File Upload 6
Same filename and directory in other branches
Code: logicmedia
quizfileupload Install (a quiz question type)
File
quizfileupload.installView source
<?php
/**
* Code: logicmedia
*
* @file
* quizfileupload Install (a quiz question type)
*/
/**
* Implementation of hook_install()
*/
function quizfileupload_install() {
drupal_install_schema('quizfileupload');
cache_clear_all('autoload:', 'cache');
variable_set('node_options_quizfileupload', array(
'status',
));
}
/**
* Implementation of hook_schema().
*/
function quizfileupload_schema() {
// Stores the users answers to a question.
$schema['quiz_fileupload_user_answers'] = array(
'fields' => array(
'answer_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'result_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'question_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'question_vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'score' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'fid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'answer_id',
),
'indexes' => array(
'answer_id' => array(
'result_id',
'question_nid',
'question_vid',
),
),
);
// store node properties
$schema['quiz_fileupload_node_properties'] = array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'filetypes' => array(
'type' => 'text',
),
),
'primary key' => array(
'nid',
'vid',
),
);
return $schema;
}
/**
* Implementation of hook_uninstall()
*/
function quizfileupload_uninstall() {
drupal_uninstall_schema('quizfileupload');
drupal_set_message(t('The quiz file upload module has been uninstalled. Quiz file upload nodes may still exist, but they will not function properly.'));
}
Functions
Name![]() |
Description |
---|---|
quizfileupload_install | Implementation of hook_install() |
quizfileupload_schema | Implementation of hook_schema(). |
quizfileupload_uninstall | Implementation of hook_uninstall() |