There is already basic article on upgrading Drupal 8 to Drupal 9, however, there is a bit more to consider, with my current setup of Drupal using composer.
Prerequisites
First install the Upgrade Status module. After installing go to Reports -> Upgrade Status and click on the check manually link scan your site for Drupal 9 readiness. Under the Drupal core and hosting environment, make sure you meet the following requirements:
- Drupal core should be either 8.8.x or 8.9.x (see Update Drupal 8 core via composer on your local environment)
- PHP should be at least version 7.3
- MariaDB should be at least version 10.3.7
- Apache should be at least version 2.4.7
- Drush should be at least version 10
Upgrade to Drush 10
Run the following composer commands to update to Drush 10
composer remove drush/drush
composer require drush/drush:^10
Scan installed modules
- Select all the projects, including the uninstalled modules, under Contributed projects and click the Scan selected at the bottom
- After scanning, analyze each project whether it is compatible with Drupal 9 or not
- Check each modules if it can be updated to be compatible with Drupal 8 & 9 and update them - remember to run update.php
- Those modules that are not ready for Drupal 9 or incompatible, uninstall them and remove them using composer
Note: When updating to Webform 6.x, make sure to install jquery_ui_checkboxradio
Replace Drupal Scaffold
- Temporarily add write access to protected files and directories
chmod 777 web/sites/default find web/sites/default -name "*settings.php" -exec chmod 777 {} \; find web/sites/default -name "*services.yml" -exec chmod 777 {} \;
- Remove the old drupal-scaffold
composer remove drupal-composer/drupal-scaffold
- Update the composer.json file and add locations and file-mapping configurations in "extra"
"drupal-scaffold": { "initial": { ".editorconfig": "../.editorconfig", ".gitattributes": "../.gitattributes" }, "locations": { "web-root": "./web" }, "file-mapping": { "[web-root]/.htaccess": false } }
- Add new core-composer-scaffold
composer require 'drupal/core-composer-scaffold:^8.8.1'
Remove patches for Drupal core
Open composer.patches.json and remove any patches for drupal/core and save the file
Update sync directory configuration
Open your settings.php replace:
$config_directories['sync']
with:
$settings['config_sync_directory']
Update your custom themes
Open your theme's [theme].info.yml file and replace:
core: 8.x
with
core_version_requirement: ^8.8 || ^9
Open your theme's [theme].theme file and replace:
'path.alias_manager'
with:
'path_alias.manager'
Open your theme's [theme].libraries.yml and replace:
css/print.css: { media:print }
with:
css/print.css: { media: print }
Upgrade Drupal 8 to Drupal 9
- As per the article, we'll "need to pull in both the Drupal 9 version of core-recommended and dev-dependencies packages as dependencies. We use --no-update to avoid a chicken-and-egg problem with mutual dependencies":
composer require drupal/core-dev:^9.0.0 --dev --update-with-dependencies --no-update composer require drupal/core:^9.0.0 --no-update
- Then, perform the update to the code itself:
composer update
- Run any pending database updates, required if you update module code and that module needs to update the database by visiting update.php and check the Status report page.
- When complete, restore read-only access to the sites/default directory:
chmod 755 web/sites/default find web/sites/default -name "*settings.php" -exec chmod 644 {} \; find web/sites/default -name "*services.yml" -exec chmod 644 {} \;
Install other Drupal 9 modules
Once you have Drupal 9 up and running, you can now install other modules that are Drupal 9 compatible
Add new comment