[Drupal] How to update non-hacked modules using drush

| | 1 min read

It is important to keep our drupal site up-to-date. New releases of contributed modules and Drupal core come out periodically to address critical security fixes, and it's important to stay on top of updates as they are released. It is difficult to download the latest version of each module separately and then remove the old one from the sites/all/modules folder and put the the new one in that place and all. Drush comes to help us in updating the modules in an easy way. The following are the steps to update the non hacked modules using drush

  • Run the following command in the command prompt under our projects directory.

    • drush hlp > status

    The above command will create a file 'status' which list all the modules with title, name, current version and its status. If status is Unchanged that means the module is not hacked and we can simply update it with out any problem.

  • Update the modules that are not hacked by running the following command under our projects directory.

    • drush up <module name>

    The above command will download the latest version and replace the old one in the sites/all/modules directory.

    If it shows any database change then also run update.php in the browser.

By doing the above two steps you can easily update the non hacked modules.