devel.install 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * Implements hook_enable().
  4. */
  5. function devel_enable() {
  6. $t = get_t();
  7. // New module weights in core: put devel as the very last in the chain.
  8. db_update('system')
  9. ->fields(array(
  10. 'weight' => 88,
  11. ))
  12. ->condition('type', 'module')
  13. ->condition('name', 'devel')
  14. ->execute();
  15. // Create a custom menu, if Menu module is enabled.
  16. // @see devel_modules_installed()
  17. if (module_exists('menu')) {
  18. $menu = array(
  19. 'menu_name' => 'devel',
  20. 'title' => $t('Development'),
  21. 'description' => $t('Development link'),
  22. );
  23. menu_save($menu);
  24. }
  25. }
  26. /**
  27. * Implements hook_uninstall().
  28. */
  29. function devel_uninstall() {
  30. variable_del('devel_form_weights');
  31. variable_del('devel_execution');
  32. variable_del('dev_timer');
  33. variable_del('devel_query_display');
  34. variable_del('devel_redirect_page');
  35. variable_del('devel_api_url');
  36. variable_del('dev_mem');
  37. variable_del('devel_error_handlers');
  38. variable_del('devel_raw_names');
  39. variable_del('devel_switch_user_list_size');
  40. variable_del('devel_switch_user_include_anon');
  41. variable_del('devel_switch_user_show_form');
  42. // Delete the development menu.
  43. if (module_exists('menu')) {
  44. if ($devel_menu = menu_load('devel')) {
  45. menu_delete($devel_menu);
  46. }
  47. }
  48. }
  49. /**
  50. * Remove feature for storing queries. Cleanup deprecated tables and variables.
  51. */
  52. function devel_update_7000() {
  53. db_drop_table('devel_queries');
  54. db_drop_table('devel_times');
  55. }
  56. /**
  57. * Rebuild the menus since everything is defined by devel_menu().
  58. */
  59. function devel_update_7001() {
  60. db_delete('menu_links')
  61. ->condition('module', 'devel')
  62. ->execute();
  63. variable_set('menu_rebuild_needed', TRUE);
  64. return t('Devel module menu links will be rebuilt.');
  65. }
  66. /**
  67. * Remove deprecated variables - dev_query, devel_code_coverage
  68. */
  69. function devel_update_7002() {
  70. variable_del('dev_query'); // Sad trombone. http://drupalcode.org/viewvc/drupal/drupal/includes/database.mysql.inc?revision=1.2&view=markup
  71. variable_del('devel_code_coverage');
  72. }
  73. /**
  74. * As per issue #813132: change schablon.com to white for krumo.
  75. */
  76. function devel_update_7003() {
  77. if (variable_get('devel_krumo_skin', 'white') == 'schablon.com') {
  78. variable_set('devel_krumo_skin', 'white');
  79. }
  80. }
  81. /**
  82. * Convert devel_error_handler variable to devel_error_handlers array.
  83. */
  84. function devel_update_7004() {
  85. define('DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE', 3);
  86. $error_handler = variable_get('devel_error_handler', NULL);
  87. if (isset($error_handler)) {
  88. if ($error_handler == DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE) {
  89. $error_handlers = array(DEVEL_ERROR_HANDLER_STANDARD, DEVEL_ERROR_HANDLER_BACKTRACE_KRUMO);
  90. }
  91. else {
  92. $error_handlers = array($error_handler);
  93. }
  94. variable_del('devel_error_handler');
  95. variable_set('devel_error_handlers', drupal_map_assoc($error_handlers));
  96. }
  97. }