This post will save you some headaches when upgrading Drupal core from 8.7 to 8.9 addressing some common challenges.
Drupal 9.0.0 has been released simultaneously with Drupal 8.9.0. Drupal 8.9 is a long-term support version that will be supported until November 2021. Versions of Drupal 8 prior to 8.8.x are end-of-life and do not receive security coverage. Upgrading an existing site that’s not yet running on the latest core 8.8 or 8.9 can be challenging due to some new changes in Drupal core.
If your site version is below 8.7 make sure you upgrade to 8.7 first because the process would be a lot smoother if you are on Drupal 8.7
composer require drupal/pathauto:^1.6
composer remove --dev webflo/drupal-core-require-dev
The webflo/drupal-core-require-dev provides the require-dev dependencies of drupal/core as a standalone package.composer remove drupal-composer/drupal-scaffold
Drupal-composer scaffold provides a composer plugin for placing scaffold files (like index.php, update.php, …) from the drupal/core project into their desired location inside the web root. The purpose of scaffolding files is to allow Drupal sites to be fully managed by Composer, and still allow individual asset files to be placed in arbitrary locations.composer remove webflo/drupal-core-strict
Drupal-core-strict is a virtual package, that causes you to get exactly the versions of Drupal core's dependencies as they are specified in Drupal core's composer.lock filecomposer require --dev drupal/core-dev:^8.8
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
}
7. Run composer require drupal/core-recommended:^8.8 drupal/core:^8.8 drupal/core-composer-scaffold:^8.8 --update-with-dependencies
"drupal/core:^8.8" is added because the composer may not be able to resolve the dependency tree. The drupal/core-recommended is the new recommended project template for Drupal 8 projects. Once the above command is successful, you can run composer remove drupal/core
to remove the package.
8. drush updatedb -y
9. drush cex -y
Check settings.php files for the $config_directories variable and replace it with $settings['config_sync_directory'] = '../config/sites/default';
if you see an error like the one below after running composer command:
Installation failed, reverting ./composer.json to its original content. [RuntimeException] Could not delete /.../web/sites/default/default.services.yml:
You can resolve this with: chmod +w web/sites/default
and run the composer command again.
If everything goes well and you see the site breaking on some pages like /admin/modules or any other page with this error in the log
Drupal\Core\Extension\Exception\UnknownExtensionException: The module does not exist or is not installed. in Drupal\Core\Extension\ExtensionList->getExtensionInfo() (line 346 of /app/web/core/lib/Drupal/Core/Extension/ExtensionList.php).
You can resolve that by running drush ev "\Drupal::configFactory()->getEditable('core.extension')->set('profile', 'standard')->save();"
locally. This command enables the standard profile.
Note that you will need to run the same command on production before you can import configurations.
Do you have other tips or have questions, don’t hesitate to contact Fred.
Einar Ryvarden, digitalsjef, Tidsskrift for Den norske legeforening deler sine beste tips for et godt internt søk på nettsider.
Vi er på jakt etter deg som liker både folk og teknologi, men ikke nødvendigvis har noen teknologiutdanning.