1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- /**
- * @file
- * QBF module - installer
- *
- * Copyright 2008 Ouest Systèmes Informatiques SARL
- *
- * Author FG Marand
- *
- * License GPL2 or later
- */
- // $Id: qbf.install,v 1.1.2.3 2008-10-03 13:47:41 marand Exp $
- /**
- * Implement hook_install().
- *
- * - Create the QBF tables
- * - qbf_queries
- * - Assign initial settings
- * - none
- *
- * @todo support PGSQL
- * @ingroup hooks
- * @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', "
- . " `created` INT(10) NOT NULL DEFAULT '0' COMMENT 'Creation timestamp', "
- . " `updated` INT(10) NOT NULL DEFAULT '0' COMMENT 'Update timestamp', "
- . ' PRIMARY KEY (`qid`) , '
- . ' KEY `uid` (`uid`), '
- . ' KEY `updated`(`updated`) '
- . ' ) '
- . '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}
- *
- * @ingroup hooks
- * @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.
- *
- * @ingroup hooks
- * @return array
- */
- function qbf_update_5000() {
- return array();
- }
|