Skip to content

Updating Drupal

Introduction

This section describes how to update Drupal and its modules using Composer. If you installed Islandora using the Islandora Playbook or ISLE, then your Drupal was installed by Composer, so it is best practice to continue using Composer for updates. The method on this section is not specific to Islandora, and does not (yet) include how to update Islandora Features.

How to upgrade Drupal in ISLE

For specific instructions on how to upgrade Drupal core and the Drupal modules installed within ISLE, please refer to the documentation page: Maintaining Your Drupal Site

What is Composer

It is recommended by Drupal.org and the Islandora community to use Composer with Drupal for various tasks.

"Composer is a dependency manager for PHP. Drupal core uses Composer to manage core dependencies like Symfony components and Guzzle." [Source]

Always create backs ups (DB and files) before updating

Before updating either Drupal core or Drupal modules:

  • Back up both your files and database. Having a complete backup makes it easy to revert to the prior version if the update fails.
  • Optionally, if you made manual modifications to files like .htaccess, composer.json, or robots.txt, copy them somewhere easy to find. Because after you've installed the new Drupal core, you will need to re-apply the changes. For example, Acquia Dev Desktop places a .htaccess file in the top-level directory and without it, only the homepage on your site will work.

Warning: Always revert to a backup if you get a fatal error in the update process.

Updating Drupal Core

Over time new versions of Drupal “core” are released, and Islandora users are encouraged to install official Drupal core updates and security patches. On the other hand “alpha” and “beta" versions of Drupal core should only be installed by advanced users for testing purposes.

The Islandora community STRONGLY recommends that the "Composer" method of upgrading Drupal core be used with Islandora as mentioned here.

Here is an overview of the steps for updating Drupal core using Composer

Back Up

First make sure you have made database and file back ups.

1) First, verify that an update of Drupal core actually is available:

composer outdated "drupal/*"

If there is no line starting with drupal/core, Composer isn't aware of any update. If there is an update, continue with the commands below.

2) Assuming you are used to updating Drupal and know all the precautions that you should take, the update is as simple as:

composer update drupal/core --with-dependencies

If you want to know all packages that will be updated by the update command, use the --dry-run option first.

Alternate syntax for Islandora 8 needed

If you are running the older Islandora 8 codebase that predates the Islandora 2 release, note that Islandora 8 is configured to use a fork of drupal-composer/drupal-project which requires this specific composer syntax compared to other Drupal 8+ sites:

composer update drupal/core webflo/drupal-core-require-dev "symfony/*" --with-dependencies

In addition, if you are upgrading from 8.5 to 8.7, you need to replace "~8.5.x" with "^8.7.0" for drupal/core and webflo/drupal-core-require-dev in composer.json. [Source]

3) Apply any required database updates using drush updatedb, or use the web admin user interface.

drush updatedb

4) Clear the cache using drush cache:rebuild, or use the web admin user interface.

drush cache:rebuild

For stepwise update instructions visit this page: https://www.drupal.org/docs/8/update/update-core-via-composer#s-stepwise-update-instructions

Updating Drupal Modules

Islandora uses several general Drupal modules and some specialized Islandora Drupal modules, and over time new versions of these modules are released. There are two approaches to updating Drupal modules in Islandora: using Composer or updating modules individually. Islandora uses Composer to determine which Drupal module versions should be installed for each release of Islandora. Therefore if you update the Islandora specific Drupal modules using Composer you will also update any dependent general Drupal modules as well. The second method is to individually update Drupal modules.

For more information about how to update Drupal modules visit:

https://www.drupal.org/docs/8/extending-drupal-8/updating-modules

Back Up

First make sure you have made database and file back ups.


Last update: September 25, 2024