devel.install 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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_execution');
  31. variable_del('devel_timer');
  32. variable_del('devel_query_display');
  33. variable_del('devel_redirect_page');
  34. variable_del('devel_api_url');
  35. variable_del('devel_memory');
  36. variable_del('devel_error_handlers');
  37. variable_del('devel_raw_names');
  38. variable_del('devel_switch_user_list_size');
  39. variable_del('devel_switch_user_include_anon');
  40. variable_del('devel_switch_user_show_form');
  41. variable_del('devel_krumo_skin');
  42. variable_del('devel_page_alter');
  43. variable_del('devel_query_sort');
  44. variable_del('devel_rebuild_theme_registry');
  45. variable_del('devel_use_uncompressed_jquery');
  46. variable_del('devel_debug_mail_file_format');
  47. variable_del('devel_debug_mail_directory');
  48. // Delete the development menu.
  49. if (module_exists('menu')) {
  50. if ($devel_menu = menu_load('devel')) {
  51. menu_delete($devel_menu);
  52. }
  53. }
  54. }
  55. /**
  56. * Remove feature for storing queries.
  57. *
  58. * Cleanup deprecated tables and variables.
  59. */
  60. function devel_update_7000() {
  61. db_drop_table('devel_queries');
  62. db_drop_table('devel_times');
  63. }
  64. /**
  65. * Rebuild the menus since everything is defined by devel_menu().
  66. */
  67. function devel_update_7001() {
  68. db_delete('menu_links')
  69. ->condition('module', 'devel')
  70. ->execute();
  71. variable_set('menu_rebuild_needed', TRUE);
  72. return t('Devel module menu links will be rebuilt.');
  73. }
  74. /**
  75. * Remove deprecated variables: dev_query, devel_code_coverage.
  76. */
  77. function devel_update_7002() {
  78. variable_del('dev_query'); // Sad trombone. http://drupalcode.org/viewvc/drupal/drupal/includes/database.mysql.inc?revision=1.2&view=markup
  79. variable_del('devel_code_coverage');
  80. }
  81. /**
  82. * As per issue #813132: change schablon.com to white for krumo.
  83. */
  84. function devel_update_7003() {
  85. if (variable_get('devel_krumo_skin', 'white') == 'schablon.com') {
  86. variable_set('devel_krumo_skin', 'white');
  87. }
  88. }
  89. /**
  90. * Convert devel_error_handler variable to devel_error_handlers array.
  91. */
  92. function devel_update_7004() {
  93. define('DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE', 3);
  94. $error_handler = variable_get('devel_error_handler', NULL);
  95. if (isset($error_handler)) {
  96. if ($error_handler == DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE) {
  97. $error_handlers = array(DEVEL_ERROR_HANDLER_STANDARD, DEVEL_ERROR_HANDLER_BACKTRACE_KRUMO);
  98. }
  99. else {
  100. $error_handlers = array($error_handler);
  101. }
  102. variable_del('devel_error_handler');
  103. variable_set('devel_error_handlers', drupal_map_assoc($error_handlers));
  104. }
  105. }
  106. /**
  107. * Delete variable 'devel_form_weights'.
  108. *
  109. * 'devel_form_weights' was removed from code.
  110. */
  111. function devel_update_7005() {
  112. variable_del('devel_form_weights');
  113. }
  114. /**
  115. * Change variable 'dev_mem' to 'devel_memory'.
  116. */
  117. function devel_update_7006() {
  118. if (variable_get('dev_mem', NULL) !== NULL) {
  119. variable_set('devel_memory', variable_get('dev_mem'));
  120. }
  121. variable_del('dev_mem');
  122. }
  123. /**
  124. * Delete 'devel_xhprof_*' variables as they were removed from code.
  125. */
  126. function devel_update_7007() {
  127. variable_del('devel_xhprof_directory');
  128. variable_del('devel_xhprof_enabled');
  129. variable_del('devel_xhprof_url');
  130. }
  131. /**
  132. * Change variable "dev_timer" to "devel_timer".
  133. */
  134. function devel_update_7008() {
  135. if (variable_get('dev_timer') !== NULL) {
  136. variable_set('devel_timer', variable_get('dev_timer'));
  137. }
  138. variable_del('dev_timer');
  139. }