| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 | 
							- <?php
 
- // $Id: qbf.install,v 1.1.4.3 2009-03-17 18:49:21 marand Exp $
 
- /**
 
-  * @file
 
-  * QBF module - installer
 
-  *
 
-  * Copyright 2008-2009 Ouest Systèmes Informatiques SARL
 
-  *
 
-  * Author FG Marand
 
-  *
 
-  * Licensed under the CeCILL 2.0 and the General Public Licence version 2 or later
 
-  */
 
- // We need to import the module to access its named constants
 
- require_once(drupal_get_path('module', 'qbf') .'/qbf.module');
 
- /**
 
-  * Implement hook_schema().
 
-  *
 
-  * @ingroup hooks
 
-  *
 
-  * @return array
 
-  */
 
- function qbf_schema()
 
-   {
 
-   $schema[QBF_TABLE_NAME] = array
 
-     (
 
-     'description' => t('Saved QBF queries.'),
 
-     'fields' => array
 
-       (
 
-       'qid' => array
 
-         (
 
-         'description' => t('Query ID'),
 
-         'type'        => 'serial',
 
-         'unsigned'    => TRUE,
 
-         'not null'    => TRUE,
 
-         ),
 
-       'uid' => array
 
-         (
 
-         'description' => t('User ID'),
 
-         'type'        => 'int',
 
-         'unsigned'    => TRUE,
 
-         'not null'    => TRUE,
 
-         'default'     => 0,
 
-         ),
 
-       'name' => array
 
-         (
 
-         'description' => t('Query name'),
 
-         'type'        => 'varchar',
 
-         'length'      => 40,
 
-         'not null'    => TRUE,
 
-         'default'     => '',
 
-         ),
 
-       'query' => array
 
-         (
 
-         'description' => t('Query array'),
 
-         'type'        => 'text',
 
-         'not null'    => TRUE,
 
-         ),
 
-       'created' => array
 
-         (
 
-         'description' => 'Query creation timestamp.',
 
-         'type'        => 'int',
 
-         'not null'    => TRUE,
 
-         'default'     => 0,
 
-         ),
 
-       'updated' => array
 
-         (
 
-         'description' => 'Query update timestamp',
 
-         'type'        => 'int',
 
-         'not null'    => TRUE,
 
-         'default'     => 0,
 
-         ),
 
-       ),
 
-     'primary key' => array('qid'),
 
-     'indexes' => array
 
-       (
 
-       'query_updated' => array('updated'),
 
-       'query_created' => array('created'),
 
-       ),
 
-     'unique keys' => array(),
 
-     );
 
-   return $schema;
 
-   }
 
- /**
 
-  * Implement hook_install().
 
-  *
 
-  * - Install schema
 
-  * - Assign initial settings
 
-  *
 
-  * @ingroup hooks
 
-  * @return void
 
-  */
 
- function qbf_install()
 
-   {
 
-   drupal_install_schema('qbf');
 
-   // Initialize settings
 
-   $ar_const = get_defined_constants();
 
-   $ar_const = array_keys($ar_const);
 
-   $count = 0;
 
-   $init_count = 0;
 
-   foreach ($ar_const as $name)
 
-     {
 
-     if (strpos($name, 'QBF_VAR_') === 0)
 
-       {
 
-       $count++;
 
-       $default = 'QBF_DEF_'. drupal_substr($name, drupal_strlen('QBF_VAR_'));
 
-       if (defined($default))
 
-         {
 
-         variable_set(constant($name), constant($default));
 
-         $init_count++;
 
-         }
 
-       }
 
-     }
 
-   drupal_set_message(t('Initialized QBF module settings (@initCount/@count parameters). You can <a href="!link">complete setup</a>.',
 
-     array
 
-       (
 
-       '@initCount' => $init_count,
 
-       '@count'     => $count,
 
-       '!link'      => url(QBF_PATH_SETTINGS),
 
-       )
 
-     ));
 
-   }
 
- /**
 
-  * Implement hook_uninstall().
 
-  *
 
-  * - Uninstall schema
 
-  * - 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()
 
-   {
 
-   drupal_uninstall_schema('qbf');
 
-   // Remove settings
 
-   $ar_const = get_defined_constants();
 
-   $ar_const = array_keys($ar_const);
 
-   foreach ($ar_const as $name)
 
-     {
 
-     if (strpos($name, 'QBF_VAR_') === 0)
 
-       {
 
-       variable_del($name);
 
-       }
 
-     }
 
-   drupal_set_message(t('Removed QBF module settings.'));
 
-   }
 
- /**
 
-  * Implement hook_update_N().
 
-  *
 
-  * For 5.x, just define a proper initial schema version.
 
-  *
 
-  * @ingroup hooks
 
-  * @return array
 
-  */
 
- function qbf_update_5000()
 
-   {
 
-   return array();
 
-   }
 
- /**
 
-  * Implement hook_update_N().
 
-  *
 
-  * No data structure change from 5000 to 6000, but we need a 6xxx schema version.
 
-  *
 
-  * @ingroup hooks
 
-  * @return array
 
-  */
 
- function qbf_update_6000()
 
-   {
 
-   return array();
 
-   }
 
 
  |