[[security-update-module]]

=== Updating a Module

[role="summary"]
How to update a contributed module by using the administrative interface and running the Database updates script, or by using Drush.

(((Module,updating)))
(((Security update,applying)))
(((Contributed module,updating)))
(((Drush tool,using to update module)))

==== Goal

Update a contributed module and run the _Database updates_ script.

==== Prerequisite knowledge

* <<security-concept>>
* <<security-cron-concept>>

==== Site prerequisites

* A contributed module has been installed and there is an update available for
it. See <<extend-module-install>> and <<security-announce>>.

* If your site is live, you should test this process in a development
environment before running it on your production site. See
<<install-dev-making>>.

* You have created a full-site backup. See <<prevent-backups>>.

* If you want to use the user interface, the core Update Manager module must be
installed. See <<config-install>> for instructions on installing core
modules.

* If you want to use Drush, Drush must be installed. See <<install-tools>>.

==== Steps

Before you start, check for module-specific update instructions. This is
typically necessary while updating modules that involve the usage of third-party
libraries. Read and understand all module-specific requirements before
proceeding with the updates. To find instructions, check the module's project
page _Read Documentation_ link.

To view further instructions, download the tar.gz or .zip file from the project
page to your local computer. Unzip the file and look for _README.txt_,
_INSTALL.txt_, and _UPGRADE.txt_ that come with the module's installation
file. Also, review the release notes on the project page by clicking the version
number you're downloading.

// Downloads section of the Admin Toolbar project page on drupal.org.
image:images/security-update-module-release-notes.png["Release notes link"]

You can use the administrative interface or Drush to update a contributed
module. If you are updating a custom module rather than a contributed module, if
you see a message saying _Installing modules and themes requires FTP access to
your server_, or if the steps below do not work to obtain the new module files,
follow the steps in <<extend-manual-install>>. You can then continue here with
step 6 in the instructions for the administrative interface below.

===== Using the administrative interface

. Put your site in maintenance mode. See <<extend-maintenance>>.

. In the _Manage_ administrative menu, navigate to _Reports_ >
_Available updates_ > _Update_ (_admin/reports/updates/update_).

. Find and check the module in the list. Click _Download these updates_ for the
module.
+
--
// Update page for theme (admin/reports/updates/update).
image:images/security-update-module-updates.png["Available updates",width="100%"]
--

. Click _Continue_.

. Click _Run database updates_. If you obtained the new module files manually,
start with this step, and reach the database updates page by typing the URL
_example.com/update.php_ in your browser.

. Click _Continue_ and apply all updates. The database update scripts will be
executed.

. Click _Administration pages_ to return to the administration section of your
site.

. Take your site out of maintenance mode. See <<extend-maintenance>>.

. Clear the cache (refer to <<prevent-cache-clear>>).

===== Using Drush

. Find the project name for the module you wish to update. It is the last
segment of the module's project page URL. For example, if the project URL is
_https://www.drupal.org/project/admin_toolbar_, the project name is
"admin_toolbar".

. Run the following Drush command, giving the project name (for example,
`admin_toolbar`) as a parameter (if you have more than one module to update, add
the additional module project names to the end of the command, separated by
spaces):
+
----
drush up admin_toolbar
----

. Follow the instructions on the screen.

==== Expand your understanding

* Review the site log (refer to <<prevent-log>>) once the updates are complete
to check for errors.

* <<security-update-theme>>

//==== Related concepts

==== Additional resources

https://www.drupal.org/node/250790[_Drupal.org_ community documentation page "Updating modules"]


*Attributions*

Adapted by https://www.drupal.org/u/batigolix[Boris Doesborgh], and
https://www.drupal.org/u/hey_germano[Sarah German] at
https://www.advomatic.com[Advomatic], from
https://www.drupal.org/node/250790["Updating modules"], copyright 2000-2017 by
the individual contributors to the
https://www.drupal.org/documentation[Drupal Community Documentation].
