Don't hack the Drupal Core. Make a patch!

I was working on a particular job where the developer before me hacked the Drupal core and didn't leave any documentation or communicate with other developers on his changes.

This was a very big mistake. After a while, the extra overhead of maintaining the hacks and fixing bugs introduced by the core changes became too much for the development team and something had to be done.

Firstly: Don't hack the Drupal core unless there is no other option. If you're hacking the core then you'll need to maintain your own version of it. When security updates are released you won't be able to apply them unless you've documented what you've done.

Very, very rarely will you need to make a change to the Drupal System. This is because it was designed for you to extend it without changing it. That's the whole idea! In fact, of all the Drupal jobs I have worked on I have seen one instance where a hack was unavoidable. This was due to an error found and an issue was raised on Drupal.org

If you're going to make a change to the core you should create a patch and save it in a place you'll remember. I created a patches directory for a patch I recently applied to the drupal maintenance theme.

If you're using svn:


svn diff > patches/mypatch.patch

If you're not using svn or another version control system then you're nuts! See here: http://subversion.tigris.org/

If you've created a patch you'll be able to work it back into your core if you've overwritten it by a new update.


patch -p0 -i patches/mypatch.patch

This should also apply to other systems like Joomla etc.




Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options