Hacking core
Upcoming SlideShare
Loading in...5
×
 

Hacking core

on

  • 4,372 views

 

Statistics

Views

Total Views
4,372
Views on SlideShare
3,298
Embed Views
1,074

Actions

Likes
0
Downloads
6
Comments
0

5 Embeds 1,074

http://btmash.com 1067
http://drupal.org 4
http://dashboard.bloglines.com 1
http://www.ninjacloak.com 1
http://webcache.googleusercontent.com 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Hacking core Hacking core Presentation Transcript

  • Hacking Drupal Core: Why and How
    Ashok Modi – June 28, 2011
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • Questions?
    Have fun hacking Drupal Core and Contrib! ^_~