links_filter.install 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Installer file for Taxonews module
  4. *
  5. * @author Frederic G. MARAND
  6. * @version CVS: $Id: taxonews.install,v 1.2.2.3 2008/06/15 21:19:36 fgm Exp $
  7. * @copyright 2005-2008 Ouest Syst�mes Informatiques (OSI)
  8. * @license http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
  9. * @link http://drupal.org/project/taxonews
  10. * @since Version 1.10.8.2 of taxonews.module
  11. * @package taxonews
  12. */
  13. /**
  14. * We just defined this update to have a reference schema version
  15. *
  16. * @return array
  17. */
  18. function links_filter_update_5100()
  19. {
  20. $ret = array();
  21. drupal_set_message(t('Links_filter schema version is now 5100.'));
  22. return $ret;
  23. }
  24. function links_filter_install()
  25. {
  26. $dbType = $GLOBALS['db_type'];
  27. switch ($dbType)
  28. {
  29. case 'mysql':
  30. case 'mysqli':
  31. db_query
  32. (
  33. "CREATE TABLE {lf_links}
  34. (
  35. `lfl_id` int(10) unsigned NOT NULL default '0',
  36. `module` varchar(64) NOT NULL default 'node',
  37. `key1` int(10) NOT NULL default 0,
  38. `key2` int(10) NOT NULL default 0,
  39. `url` varchar(255) NOT NULL default '',
  40. PRIMARY KEY (`lfl_id`),
  41. UNIQUE KEY `ux_url` (`url`,`module`,`key1`,`key2`)
  42. ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"
  43. );
  44. break;
  45. default:
  46. drupal_set_message("Unsupported DB type $dbType");
  47. break;
  48. }
  49. }
  50. /**
  51. * Implement hook_uninstall:
  52. * - remove configuration settings (persistent variables)
  53. * - remove blocks
  54. *
  55. * By convention, all persistent variables in the main class of a module
  56. * are named VAR_something, so we can find them all safely using reflection.
  57. *
  58. * @return void
  59. */
  60. function links_filter_uninstall()
  61. {
  62. // 1. Obtain the class definition to enable Reflection
  63. $pwd = dirname(drupal_get_filename('module', 'links_filter'));
  64. // 2. Remove the module settings
  65. // Nothing yet
  66. // 3. Remove the module blocks
  67. $sq = "DELETE FROM {blocks} WHERE module = 'links_filter'";
  68. $ret = db_query($sq);
  69. drupal_set_message(t('Removed links_filter blocks.'));
  70. }