Your SlideShare is downloading. ×
0
Hacking core
Hacking core
Hacking core
Hacking core
Hacking core
Hacking core
Hacking core
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Hacking core

4,076

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
4,076
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Hacking Drupal Core: Why and How
    Ashok Modi – June 28, 2011
  • 2. Why? What about “Don’t Hack Core!”
    Contrary to what some people say, Drupal is not a one size fits all Swiss Army knife.
    Not all uses cases can be accounted for.
    Flexibility does come at a cost.
    Usually performance.
    Have you used Pressflow?
    Some very popular modules justdon’t get maintained.
  • 3. Examples
    User Module
    On user registration, wanted a way to generate simpler random passwords.
    Drupal (core or otherwise) does not provide any way to override the complex passwords it generates.
    No choice but to ‘alter’ (hack) core.
    Another issue involved bad performance on user login (without a patch – Pressflow has a variant but Drupal 6.x still slow).
    Comment module
    No index on the user id.
    Another module using the comment module referencing the user id made it very slow.
    No choice but to ‘alter’ (hack) the indexes made by core.
  • 4. Best practices
    Check the issue queue!
    If its in there, try and work towards a patch.
    Use that patch until its part of the project.
    Otherwise, create an issue if its something that could benefit rest of Drupal and work towards a patch.
  • 5. Best Practices (cont’d)
    Very simple
    Copy the module you want to override into your sites/all directory.
    Recommend creating a new directory called ‘core_modified’.
    Similarly for contrib, have a directory called ‘contrib_modified’.
    Add any changes you make into a patch file.
    Use diff on the command line or a program like Diffmerge (OSX) or winmerge (Windows) or Guiffy (all).
    Commit the patch file to your codebase.
    Will allow you to merge your changes anytime module gets updated.
    Once things in the affected module are officially fixed, you can move back to the core version.
  • 6. DEMO
    Going to go over image module change
    http://drupal.org/node/1015916
    If you try to enter data longer than 128 characters, site dies.
    Don’t know if the patch will get accepted.
    Lets dive in.
  • 7. Questions?
    Have fun hacking Drupal Core and Contrib! ^_~

×