Hello,

I am wondering how I could update a module to a specific version instead of the latest version?

I cannot use drush or composer for this.

Thanks

Comments

slewazimuth’s picture

Is this a hosted site with ssh access?

mmjvb’s picture

That is what all methods should do. Make sure the contents is replaced with the desired version. That means nothing of the old version should remain.

Obviously, how to replace depends on your infrastructure. Since no information is provided about the infrastructure in use, it remains abstract.

drupaldope’s picture

ok, I figured it out myself, it wasn't difficult, really.

step 1: delete the contents of the modules/*specific_module_you_want_to_replace_folder*

step 2: download from drupal.org the specific version of the module

step 3: replace the contents you just deleted with the new module files

step 4: run update.php

not abstract at all and this method works on ALL environments.

mmjvb’s picture

Still abstract, no problem when you know how to translate it to specific actions in your infrastructure.

Specific instructions deal with issues like security, actual location of the module and finding, downloading, uploading, extracting the desired module. Obviously, replacing it with instructions like wget, git clone, unzip, tar -xvf, ftp .....

No, it doesn't work for ALL environments. When the module was introduced via Composer it should be updated via Composer.

drupaldope’s picture

keep it simple and stupid.

best advice ever.

koushikuk’s picture

Hi,

  You can update a particular module to a specific version.  Manually you can download that specifi version from drupal.org  and replace it with you existing one. Before doing any kind of upgrade or update in in your project don't forget to take a backup. After module update don't forget to run update.php.  Thanks.

suit4’s picture

If you used composer to install your site, the correct way to update a module to a specific version is

composer require drupal/module_name:version

So, if you want to update Admin Toolbar, it looks like this:

composer require drupal/admin_toolbar:2.0

This will installbersion 8.x-2.0 of the module admin_toolbar.

@see https://www.drupal.org/docs/8/update/update-core-via-composer
@see https://www.drupal.org/docs/8/update

mmjvb’s picture

What matters is how the module was installed. Once installed with Composer, both module and drupal core need to be maintained with Composer. Assuming you didn't make the mistake to start with drupal/drupal. All other distributions allow for maintaining drupal core. About to be changed in D8.8.

Also you might need to use 'require' to adjust the version constraint in use, otherwise you can use 'update', as documented!

Specifying an exact version is considered bad practice when having Semantic Versioning in mind. So, with a conservative update policy in place the version constraint would be ~2.0.0. That allows you to update to patch releases within 2.0. Otherwise ^2.0 to allow for updates to 2.1.0 and 2.2.0 and so on as long as the version remains 2.

Use 'show -s' with Composer to find out the current version constraints.

dadaisme’s picture

Hi!

Is there a non-drush non-composer way to update a module in drupal 9? 

In my case, drupal 9 has been installed with a cpanel app and modules via the drupal interface. Dependencies using ludwig. The specific module I wish to switch version is Address from recommended to dev version to resolve an issue in the recommended version.

Will replacing the version via ftp and running update work?

Thx

mmjvb’s picture

Provided you clear cache for Drupal to see the changed version, like always!

Whether running update is required depends on the changes in the dev version. Update checks the numbers in the install file. When no new updates are made there, there is no need for running update. When you do it will tell you there is nothing to update. 

Do check the dependencies with Ludwig. Not sure what might happen when new versions of dependencies are required. It is your responsibility to see to it that those new versions are available. An additional step to replacing current with new (dev) of the module.