what to do when things go wrong with drupal
Post on 20-Oct-2014
1.995 views
DESCRIPTION
Slides from Damien McKenna's session "What to do when things go wrong with Drupal" from Drupalcamp Atlanta 2012.TRANSCRIPT
What to do when things go wrong.
(because it will)
.. withCODE!
.. andFreddie Mercury!
Damien McKennaLead Drupal Architect
@DamienMcKennadrupal.org/user/108450
“Freddie Mercury”Farrokh Bulsara
Lead vocalsQueen
DRUPAL, DAY 1
Building with Drupal
• Starting off..• Lots of trepidation• Infamous learning curve• Lots of reading – books, blogs, tutorials..• Lots of screencasts!
Building with Drupal
• Add Views & other modules• Add a little theming• Go a long way!
Building more with Drupal
• Start feeling comfortable• Add some more modules• Build lots of sites!
\o/
“We Are The Champions”“News of the World” (1977)
Continuing on..
• Install a module
• Awesome!
But then..
Notice: Undefined index: option in theme_select_or_other_none() (line 249 of /sites/all/modules/contrib/select_or_other/select_or_other.module).
• Whaaa?
Eek!
• Line 249:
• Whaaaaaaaaaaaaaaaa?
That moment..
“Going Slightly Mad”“Innuendo” (1977)
Drupalburp, noun;
• A bug.• A small bug.• It’s still a bug.• There are lots of them.
Step 1: Search issue queue
Step 1: Results
Step 1: Review
Step 2: Create a new issue!
Step 2: Create a new issue..
Step 2: Issue created!
TIME TO DEBUG!
Development Tips
1. drupal_set_message()
Whaaaa?
Development Tips
1. drupal_set_message()2. debug()
debug() output
Development Tips
1. drupal_set_message()2. debug()3. Devel module4. dpm()
dpm()
dpm() output
dpm() output awesomesauce!
Reviewing the error
• “Undefined index”• Means that an array element doesn’t exist.• I can fix that!
Original code
The fix
It works!
• Time to share the joy!
Get the code
Getting the code
Clone it!
Fix it!
Diff it!
Diff it!
Patch it!
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
Upload it!
And then..
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.
Development Tips
1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!
PATCHES.txt
Development Tips
1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!6. kpr() and exit()
kpr()
Development Tips
1. 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
MacGDBp
Development Tips
1. 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
8. Let modules die!
Redundant: see redundant
“Who Wants to Live Forever?”“A Kind of Magic” (1986)
Abandon obsolete modules
• Focus effort on fewer solutions.• More focus effort = better modules.• How many gallery systems do we need?
WHAT’S NEXT?
Contribute
• You depend upon Drupal for your future.• Drupal’s future depends upon you!
Investments
• Invest minimum of 10% of income for retirement
• Invest 10% of your week to Drupal
Time it
• 10% of 40 hour week• 4 hours per week• Friday evening!
Companies can do more
• Have a large team?• Dedicated team contributor• Organize code sprints• & fly in experts
Why?
• Learn more• Make your sites better• Make Drupal better• Everyone benefits!
More info
• Novice issues• Examine code of small
modules you use• Poke around with dpm()
& kpr()• Read issue queues• Contribute!• http://webchick.net/
embrace-the-chaos
Drupal’s future is up to us!
“The Show Must Go On”“Innuendo” (1977)
THANK YOU
Mediacurrent helps organizations architect custom websites by leveraging our proven processes and deep expertise in Drupal.
@mediacurrent mediacurrent.com