64
What to do when things go wrong. (because it will)

What to do when things go wrong with Drupal

  • View
    1.997

  • Download
    3

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: What to do when things go wrong with Drupal

What to do when things go wrong.

(because it will)

Page 2: What to do when things go wrong with Drupal

.. withCODE!

Page 3: What to do when things go wrong with Drupal

.. andFreddie Mercury!

Page 4: What to do when things go wrong with Drupal

Damien McKennaLead Drupal Architect

@DamienMcKennadrupal.org/user/108450

Page 5: What to do when things go wrong with Drupal

“Freddie Mercury”Farrokh Bulsara

Lead vocalsQueen

Page 6: What to do when things go wrong with Drupal

DRUPAL, DAY 1

Page 7: What to do when things go wrong with Drupal

Building with Drupal

• Starting off..• Lots of trepidation• Infamous learning curve• Lots of reading – books, blogs, tutorials..• Lots of screencasts!

Page 8: What to do when things go wrong with Drupal

Building with Drupal

• Add Views & other modules• Add a little theming• Go a long way!

Page 9: What to do when things go wrong with Drupal

Building more with Drupal

• Start feeling comfortable• Add some more modules• Build lots of sites!

Page 10: What to do when things go wrong with Drupal

\o/

“We Are The Champions”“News of the World” (1977)

Page 11: What to do when things go wrong with Drupal

Continuing on..

• Install a module

• Awesome!

Page 12: What to do when things go wrong with Drupal

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?

Page 13: What to do when things go wrong with Drupal

Eek!

• Line 249:

• Whaaaaaaaaaaaaaaaa?

Page 14: What to do when things go wrong with Drupal

That moment..

“Going Slightly Mad”“Innuendo” (1977)

Page 15: What to do when things go wrong with Drupal

Drupalburp, noun;

• A bug.• A small bug.• It’s still a bug.• There are lots of them.

Page 16: What to do when things go wrong with Drupal

Step 1: Search issue queue

Page 17: What to do when things go wrong with Drupal

Step 1: Results

Page 18: What to do when things go wrong with Drupal

Step 1: Review

Page 19: What to do when things go wrong with Drupal

Step 2: Create a new issue!

Page 20: What to do when things go wrong with Drupal

Step 2: Create a new issue..

Page 21: What to do when things go wrong with Drupal

Step 2: Issue created!

Page 22: What to do when things go wrong with Drupal

TIME TO DEBUG!

Page 23: What to do when things go wrong with Drupal

Development Tips

1. drupal_set_message()

Page 24: What to do when things go wrong with Drupal

Whaaaa?

Page 25: What to do when things go wrong with Drupal

Development Tips

1. drupal_set_message()2. debug()

Page 26: What to do when things go wrong with Drupal

debug() output

Page 27: What to do when things go wrong with Drupal

Development Tips

1. drupal_set_message()2. debug()3. Devel module4. dpm()

Page 28: What to do when things go wrong with Drupal

dpm()

Page 29: What to do when things go wrong with Drupal

dpm() output

Page 30: What to do when things go wrong with Drupal

dpm() output awesomesauce!

Page 31: What to do when things go wrong with Drupal

Reviewing the error

• “Undefined index”• Means that an array element doesn’t exist.• I can fix that!

Page 32: What to do when things go wrong with Drupal

Original code

Page 33: What to do when things go wrong with Drupal

The fix

Page 34: What to do when things go wrong with Drupal

It works!

• Time to share the joy!

Page 35: What to do when things go wrong with Drupal

Get the code

Page 36: What to do when things go wrong with Drupal

Getting the code

Page 37: What to do when things go wrong with Drupal

Clone it!

Page 38: What to do when things go wrong with Drupal

Fix it!

Page 39: What to do when things go wrong with Drupal

Diff it!

Page 40: What to do when things go wrong with Drupal

Diff it!

Page 41: What to do when things go wrong with Drupal

Patch it!

Page 42: What to do when things go wrong with Drupal

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

Page 43: What to do when things go wrong with Drupal

Upload it!

Page 44: What to do when things go wrong with Drupal

And then..

Page 45: What to do when things go wrong with Drupal

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.

Page 46: What to do when things go wrong with Drupal

Development Tips

1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!

Page 47: What to do when things go wrong with Drupal

PATCHES.txt

Page 48: What to do when things go wrong with Drupal

Development Tips

1. drupal_set_message()2. debug()3. Devel module4. dpm()5. Track your patches!6. kpr() and exit()

Page 49: What to do when things go wrong with Drupal

kpr()

Page 50: What to do when things go wrong with Drupal

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

Page 51: What to do when things go wrong with Drupal

MacGDBp

Page 52: What to do when things go wrong with Drupal

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!

Page 53: What to do when things go wrong with Drupal

Redundant: see redundant

“Who Wants to Live Forever?”“A Kind of Magic” (1986)

Page 54: What to do when things go wrong with Drupal

Abandon obsolete modules

• Focus effort on fewer solutions.• More focus effort = better modules.• How many gallery systems do we need?

Page 55: What to do when things go wrong with Drupal

WHAT’S NEXT?

Page 56: What to do when things go wrong with Drupal

Contribute

• You depend upon Drupal for your future.• Drupal’s future depends upon you!

Page 57: What to do when things go wrong with Drupal

Investments

• Invest minimum of 10% of income for retirement

• Invest 10% of your week to Drupal

Page 58: What to do when things go wrong with Drupal

Time it

• 10% of 40 hour week• 4 hours per week• Friday evening!

Page 59: What to do when things go wrong with Drupal

Companies can do more

• Have a large team?• Dedicated team contributor• Organize code sprints• & fly in experts

Page 60: What to do when things go wrong with Drupal

Why?

• Learn more• Make your sites better• Make Drupal better• Everyone benefits!

Page 61: What to do when things go wrong with Drupal

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

Page 62: What to do when things go wrong with Drupal

Drupal’s future is up to us!

“The Show Must Go On”“Innuendo” (1977)

Page 63: What to do when things go wrong with Drupal

THANK YOU

Page 64: What to do when things go wrong with Drupal

Mediacurrent helps organizations architect custom websites by leveraging our proven processes and deep expertise in Drupal.

@mediacurrent mediacurrent.com