devel.install 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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('dev_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_xhprof_directory');
  47. variable_del('devel_xhprof_enabled');
  48. variable_del('devel_xhprof_url');
  49. variable_del('devel_debug_mail_file_format');
  50. variable_del('devel_debug_mail_directory');
  51. // Delete the development menu.
  52. if (module_exists('menu')) {
  53. if ($devel_menu = menu_load('devel')) {
  54. menu_delete($devel_menu);
  55. }
  56. }
  57. }
  58. /**
  59. * Remove feature for storing queries. Cleanup deprecated tables and variables.
  60. */
  61. function devel_update_7000() {
  62. db_drop_table('devel_queries');
  63. db_drop_table('devel_times');
  64. }
  65. /**
  66. * Rebuild the menus since everything is defined by devel_menu().
  67. */
  68. function devel_update_7001() {
  69. db_delete('menu_links')
  70. ->condition('module', 'devel')
  71. ->execute();
  72. variable_set('menu_rebuild_needed', TRUE);
  73. return t('Devel module menu links will be rebuilt.');
  74. }
  75. /**
  76. * Remove deprecated variables - dev_query, devel_code_coverage
  77. */
  78. function devel_update_7002() {
  79. variable_del('dev_query'); // Sad trombone. http://drupalcode.org/viewvc/drupal/drupal/includes/database.mysql.inc?revision=1.2&view=markup
  80. variable_del('devel_code_coverage');
  81. }
  82. /**
  83. * As per issue #813132: change schablon.com to white for krumo.
  84. */
  85. function devel_update_7003() {
  86. if (variable_get('devel_krumo_skin', 'white') == 'schablon.com') {
  87. variable_set('devel_krumo_skin', 'white');
  88. }
  89. }
  90. /**
  91. * Convert devel_error_handler variable to devel_error_handlers array.
  92. */
  93. function devel_update_7004() {
  94. define('DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE', 3);
  95. $error_handler = variable_get('devel_error_handler', NULL);
  96. if (isset($error_handler)) {
  97. if ($error_handler == DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE) {
  98. $error_handlers = array(DEVEL_ERROR_HANDLER_STANDARD, DEVEL_ERROR_HANDLER_BACKTRACE_KRUMO);
  99. }
  100. else {
  101. $error_handlers = array($error_handler);
  102. }
  103. variable_del('devel_error_handler');
  104. variable_set('devel_error_handlers', drupal_map_assoc($error_handlers));
  105. }
  106. }
  107. /**
  108. * Delete variable 'devel_form_weights' from database as it was removed from code.
  109. */
  110. function devel_update_7005() {
  111. variable_del('devel_form_weights');
  112. }
  113. /**
  114. * Change variable 'dev_mem' to 'devel_memory'.
  115. */
  116. function devel_update_7006() {
  117. if (variable_get('dev_mem', NULL) !== NULL) {
  118. variable_set('devel_memory', variable_get('dev_mem'));
  119. }
  120. variable_del('dev_mem');
  121. }