What to do when things go wrong with Drupal

2,896 views
2,795 views

Published on

Slides from Damien McKenna's session "What to do when things go wrong with Drupal" from Drupalcamp Atlanta 2012.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,896
On SlideShare
0
From Embeds
0
Number of Embeds
39
Actions
Shares
0
Downloads
5
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

What to do when things go wrong with Drupal

  1. 1. What to do when things go wrong. (because it will)
  2. 2. .. withCODE!
  3. 3. .. andFreddie Mercury!
  4. 4. Damien McKenna Lead Drupal Architect @DamienMcKenna drupal.org/user/108450
  5. 5. “Freddie Mercury” Farrokh Bulsara Lead vocals Queen
  6. 6. Drupal, Day 1
  7. 7. Building with Drupal• Starting off..• Lots of trepidation• Infamous learning curve• Lots of reading – books, blogs, tutorials..• Lots of screencasts!
  8. 8. Building with Drupal• Add Views & other modules• Add a little theming• Go a long way!
  9. 9. Building more with Drupal• Start feeling comfortable• Add some more modules• Build lots of sites!
  10. 10. o/“We Are The Champions”“News of the World” (1977) • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  11. 11. Continuing on..• Install a module• Awesome!
  12. 12. But then..Notice: Undefined index: option intheme_select_or_other_none() (line 249of/sites/all/modules/contrib/select_or_other/select_or_other.module).• Whaaa?
  13. 13. Eek!• Line 249:• Whaaaaaaaaaaaaaaaa?
  14. 14. That moment..“Going Slightly Mad”“Innuendo” (1977) • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  15. 15. Drupalburp, noun;• A bug.• A small bug.• It’s still a bug.• There are lots of them.
  16. 16. Step 1: Search issue queue • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  17. 17. Step 1: Results• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  18. 18. Step 1: Review• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  19. 19. Step 2: Create a new issue! • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  20. 20. Step 2: Create a new issue.. • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  21. 21. Step 2: Issue created!• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  22. 22. Time to debug!
  23. 23. Development Tips1. drupal_set_message()
  24. 24. Whaaaa?• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  25. 25. Development Tips1. drupal_set_message()2. debug()
  26. 26. debug() output• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  27. 27. Development Tips1. drupal_set_message()2. debug()3. Devel module4. dpm()
  28. 28. dpm()• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  29. 29. dpm() output• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  30. 30. dpm() output awesomesauce! • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  31. 31. Reviewing the error• “Undefined index”• Means that an array element doesn’t exist.• I can fix that!
  32. 32. Original code• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  33. 33. The fix• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  34. 34. It works!• Time to share the joy!
  35. 35. Get the code• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  36. 36. Getting the code• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  37. 37. Clone it!• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  38. 38. Fix it!• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  39. 39. Diff it!• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  40. 40. Diff it!• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  41. 41. Patch it!• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  42. 42. Name it!• Patch naming: project name & issue number.• [project]-n[issue]-[comment#].patch• [project]-n[issue]-[comment#]- [message].patch – drupal-n1067120-145-d7.patch – metatag-n1820374.patch – views-n1809862-7.patch
  43. 43. Upload it!• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  44. 44. And then..• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  45. 45. Wait.• Maintainers can take time to respond.• People live busy lives. – Drupal 8’s “development babies” list :-)• Other modules or core work may take a higher priority.• Don’t give up if little or no response.
  46. 46. Development Tips1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!
  47. 47. PATCHES.txt• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  48. 48. Development Tips1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!6. kpr() and exit()
  49. 49. kpr()• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  50. 50. Development Tips1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!6. kpr() and exit()7. xdebug – hardcore debugging! • .. and IDE debugger or MacGDBp
  51. 51. MacGDBp• Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  52. 52. Development Tips1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!6. kpr() and exit()7. xdebug – hardcore debugging! • .. and IDE debugger or MacGDBp8. Let modules die!
  53. 53. Redundant: see redundant“Who Wants to Live Forever?”“A Kind of Magic” (1986) • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  54. 54. Abandon obsolete modules• Focus effort on fewer solutions.• More focus effort = better modules.• How many gallery systems do we need?
  55. 55. What’s next?
  56. 56. Contribute• You depend upon Drupal for your future.• Drupal’s future depends upon you!
  57. 57. Investments• Invest minimum of 10% of income for retirement• Invest 10% of your week to Drupal
  58. 58. Time it• 10% of 40 hour week• 4 hours per week• Friday evening!
  59. 59. Companies can do more• Have a large team?• Dedicated team contributor• Organize code sprints• & fly in experts
  60. 60. Why?• Learn more• Make your sites better• Make Drupal better• Everyone benefits!
  61. 61. More info• Novice issues• Examine code of small modules you use • Click to edit Master text styles• Poke around with dpm() – Second level & kpr() – Third level• Read issue queues • Fourth level – Fifth level• Contribute!• http://webchick.net/emb race-the-chaos
  62. 62. Drupal’s future is up to us!“The Show Must Go On”“Innuendo” (1977) • Click to edit Master text styles – Second level – Third level • Fourth level – Fifth level
  63. 63. Thank you
  64. 64. Mediacurrent helps organizations architect custom websites byleveraging our proven processes and deep expertise in Drupal. @mediacurrent mediacurrent.com

×