93 lines
No EOL
2.1 KiB
Text
93 lines
No EOL
2.1 KiB
Text
<?php
|
|
/**
|
|
* QBF module - installer
|
|
*
|
|
* @copyright 2008 Ouest Systèmes Informatiques SARL
|
|
* @author FG Marand
|
|
* @license GPL2 or later
|
|
* @package QBF
|
|
*/
|
|
|
|
// $Id: qbf.install,v 1.1 2008-09-02 08:39:07 marand Exp $
|
|
|
|
/**
|
|
* Implement hook_install().
|
|
*
|
|
* - Create the QBF tables
|
|
* - qbf_queries
|
|
* - Assign initial settings
|
|
* - none
|
|
*
|
|
* @todo support PGSQL
|
|
* @return void
|
|
*/
|
|
function qbf_install()
|
|
{
|
|
switch ($GLOBALS['db_type'])
|
|
{
|
|
case 'mysql':
|
|
case 'mysqli':
|
|
$sq = 'CREATE TABLE {qbf_queries} '
|
|
. ' ( '
|
|
. " `qid` INT(10) NOT NULL DEFAULT '0' COMMENT 'Query ID', "
|
|
. " `uid` INT(10) NOT NULL DEFAULT '0' COMMENT 'User ID', "
|
|
. " `name` VARCHAR(40) NOT NULL DEFAULT '' COMMENT 'Query name', "
|
|
. " `query` TEXT NOT NULL COMMENT 'Query array', "
|
|
. ' PRIMARY KEY (`qid`) , '
|
|
. ' INDEX (`uid`) '
|
|
. ' ) '
|
|
. 'ENGINE = MyISAM '
|
|
. 'CHARACTER SET = utf8 '
|
|
. "COMMENT = 'QBF Query store' ";
|
|
db_query($sq);
|
|
break;
|
|
|
|
case pgsql:
|
|
default:
|
|
drupal_set_message(t('Unsupported database backend for QBF module: @db',
|
|
array('@db' => $GLOBALS['db_type'])), 'error');
|
|
break;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implement hook_uninstall().
|
|
*
|
|
* - Drop all the tables maintained by the module
|
|
* - qbf_queries
|
|
* - Remove nodes of all the types maintained by the module
|
|
* - none
|
|
* - Remove module settings
|
|
* - none
|
|
* - Do NOT remove module schema version from {system}
|
|
*
|
|
* @return void
|
|
*/
|
|
function qbf_uninstall()
|
|
{
|
|
switch ($GLOBALS['db_type'])
|
|
{
|
|
case 'mysql':
|
|
case 'mysqli':
|
|
case 'pgsql':
|
|
db_query("DROP TABLE {qbf_queries}");
|
|
break;
|
|
|
|
default:
|
|
drupal_set_message(t('Unsupported database backend for QBF module: @db',
|
|
array('@db' => $GLOBALS['db_type'])), 'error');
|
|
break;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implement hook_update_N().
|
|
*
|
|
* For now, just define a proper initial schema version.
|
|
*
|
|
* @return array
|
|
*/
|
|
function qbf_update_5000()
|
|
{
|
|
return array();
|
|
} |