Updating Drupal 9 core with Composer

nabbisen - May 28 '21 - - Dev Community

Introduction

This post is a sequel to my past story where I succeeded in getting "Available updates" in admin panel of Drupal.

Successful

Body

Event

It recommended updating to 9.1.9 because of a security vulnerability 9.1.8 today.
However, there was none of auto core update.
Therefore, I tried to update it manually. It was my first Drupal core update with update.php via a web browser instead of drush commands.

Besides, when drush is installed with Drupal, there is a way to update database with it:

Operation

Connect to the server via SSH.
Move to Drupal directory:

$ cd <drupal-dir>
Enter fullscreen mode Exit fullscreen mode

It is able to check outdated packages beforehand:

$ composer outdated
...
drupal/core                          9.1.8   9.1.9   Drupal is an open source content man...
...
Enter fullscreen mode Exit fullscreen mode

Then, update drupal/core + its dependencies only.

$ composer update drupal/core "drupal/core-*" --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 6 updates, 0 removals
  - Upgrading drupal/core (9.1.8 => 9.1.9)
  ...
Enter fullscreen mode Exit fullscreen mode

Optionally (and maybe not being recommended), it's also able to update all:

$ #composer update
Enter fullscreen mode Exit fullscreen mode

Next, if drush exists, drush update is available.
But, in my case, it doesn't.
Alternatively, I opened https://<fqdn>/update.php in my web browser, following the official documentation, Drupal - Updating Drupal core via Composer.
Said, "Drupal database update"!

update.php in web browser

Happily, there was nothing to do that time.

finished

Conclusion

The status report became healthy again, saying "Up to date βœ…"πŸ™‚

status report

Reference

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .