Disabling module updates

Okay, every honest Drupal developer knows, that hacking core is a bad thing. Hacking contributed module is not the best thing in the world, too — for obvious reasons: modules get updates , and updating module is very easy, unless you’ve applied some hacks to it.

But, sometimes, we need to apply some changes to some contrib module. If it is a big customer site, we can’t just say “Hey guys, your team can update this module and this module using drush, but don’t touch this module, please!”. That’s just ugly, that someone needs to remember such stuff — and I bet that in 2 weeks they forget and download new version of module from Drupal.org. And all our work is lost.

So, the solution here is to disable specific module updates automation. 

It was not so obvious for me. I’ve always thought that update status of module/theme is tracked using module/theme name (the .info file name without extension). That would mean that if developer renames theme, all blocks settings are reset, theme enabled status is reset to disabled, and all kinds of headaches like these. 

But things are much easier! Just go to .info file of the module, and you’ll see this:

; $Id: filefield.info,v 1.9 2009/04/01 08:57:49 quicksketch Exp $
name = FileField
description = Defines a file field type.
dependencies[] = content
package = CCK
core = 6.x
php = 5.0
; Information added by drupal.org packaging script on 2010-07-01
version = "6.x-3.7"
core = "6.x"
project = "filefield"
datestamp = "1277943012"

Do you see “project” line here? that’s what we need. Change it to something like “hacked_%modulename%” and you’re done.

Please keep in mind that the whole thing about hacking contributed modules is still ugly. Try to avoid that!

Important UPD from Dave Reid: update_advanced module does the trick!

Comments

You're still hacking a module. You could also just use http://drupal.org/project/update_advanced to ignore updates for a certain project.

23 December, 2010

Well, I’m hacking the module that’s already hacked, anyways :)
But thank you for a more clean solution, I didn’t know about update_advanced.

29 December, 2010

Complicated modules for me, it is not easy to understand.

17 August, 2011

There is no such thing as "hacking" a module. Refactoring code is a normal thing. If you are nice enough to present a patch, persistent and lucky then your code can be pushed into the main branch. But often this does not happen because "every man's drink is not wine".

Nice tip! Thanks

26 January, 2012

Post new comment

Private and will not be shown publicly.
  • 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

Note for potential spammers: all links in your comment will not be indexed by search engines.

Anton Sidashin

Anton Sidashin senior developer, Pixeljets co-founder

I'm a web developer specializing in PHP and Javascript, and Drupal, of course. I'm building Drupal projects since 2005, and I was working as full-time senior engineer in CS-Cart for a while, building revolutionary e-commerce software. In my free time, I enjoy playing soccer, building my body in gym, and playing guitar.

Drupal.org ID: restyler
Drupal association member