How to mark a module so drush/drupal won't upgrade it

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
404's picture

How to mark a module so drush won't upgrade it? In other words, there's a module I want to keep it at a fixed version, I don't want drupal to check updated version for that module. So I can use drush up --no-core without worrying that module would be upgraded.

I tired to change the module.info, change the project name, the timestamp date, didn' t work.

Comments

There are two ways. drush

greg.1.anderson's picture

There are two ways.

  1. drush pm-updatecode --lock=module_to_ignore

  2. Use the update_advanced module (http://drupal.org/project/update_advanced); it will allow you to mark modules that you want to ignore on the module administration page.

Note that this question is also answered in the ever-handy Drush FAQ: http://drupal.org/drush-faq

It works, thank you!

404's picture

--lock param is a good solution.

Thank you very much! It could be better if I can write the module names in a file and have --lock to load it.

Sorry I didn't read through the faq. Most of the time I just use drush |grep keywords or dush.ws to learn how to use drush.

I see the drush.ws was updated to include this function. I should have read it before posting a question.

It's even better if there's a drush --long-help that lists all the parameters.

Something like this in a

brianmercer's picture

Something like this in a drushrc.php file will probably work:

$command_specific['pm-update']['lock'] = array(
  'module1',
  'module2',
  'module3'
);

This is neat! Than you!

404's picture

This is neat! Than you!

old cheesy solution

Michael-IDA's picture

I've been using this since drush ~4.x, somewhat cheesy, but works:

# drush dis -y {base module name(s)}
{copy the list displayed by: "The following extensions will be disabled"}
# drush up
# drush en -y {all modules that were disabled}

With a known set of modules to not upgrade it's easy enough to script it (and dump the output to a log file for ease of viewing).

Of course expect extra QA time verifying the non-upgraded modules work correctly with the new core and other upgraded modules...

Best,
Sam

Note: syntax not verified.

.drush-lock-update file blocks updating

diamondsea's picture

In modern drush you can put a .drush-lock-update file in the module's top directory. This will prevent "drush up" from updating that file. The contents of the file will be displayed in the "drush up" listing next to the module version.

You can also use "drush up --lock=ModuleName" to create the file for you.

.drush-lock-update

tolnor's picture

Hello diamondsea!

I have some sites with changed themes and i do not want to update it by drush.
The .drush-lock-update file will block the update of that themes too, or this work only for modules?

Thanks for your answer!

Works for themes too.

Stefan Lehmann's picture

Works for themes too.

Thank you Stefan :-)

tolnor's picture

Thank you Stefan :-)

drush

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: