PreviousNext continue to be major contributors to the development and promotion of Drupal 8. As participants of the Drupal 8.8.0 Beta Testing Program, we thought it would be useful to document the steps we took to update one of our sites on Drupal 8.7 to the latest 8.8.0 beta.
Every site is different, so your mileage may vary, but it may save you some time.
Drupal 8.8 is a big release, with a number of new features added, and APIs deprecated to pave the way to a Drupal 9.0 release. Thankfully, the upgrade process was fairly straightforward in our case.
Upgrade PathAuto
First step was to deal with The Path Alias core subsystem has been moved to the “path_alias” module This meant some classes were moved to different namespaces. In order to make things smoother, we installed the latest version of pathauto module and clear the caches.
composer require drupal/pathauto:^1.6@beta
drush cr
Core Dev Composer Package
We use the same developer tools for testing as Drupal core, and we want to switch to the new core composer packages, so first we remove the old one.
composer remove --dev webflo/drupal-core-require-dev
Update Patches
We sometimes need to patch core using cweagans/composer-patches. In the case of this site, we are using a patch from ckeditor_stylesheets cache busting: use system.css_js_query_string which needed to be re-rolled for Drupal 8.8.x. We re-rolled the patch, then updated the link in the extra/patches section.
Update Drupal Core and Friends
In our first attempt, composer could not install due to a version conflict with some symfony packages (symfony/finder, symfony/filesystem and symfony/debug). These are transient dependencies (we don’t require them explicitly). Our solution was to explicitly require them (temporarily) with versions that Drupal core is compatible with, then remove them afterwards.
First require new Drupal core and dependencies:
composer require --update-with-dependencies
drupal/core:^8.8@beta
symfony/finder:^3.4
symfony/filesystem:^3.4
Second, require new core-dev package and dependencies:
composer require --dev --update-with-dependencies
drupal/core-dev:^8.8@beta
symfony/debug:^3.4
Lastly, remove the temporary required dependencies:
composer remove -n
symfony/finder
symfony/filesystem
symfony/debug
Update the Database and Export Config
Now our code is updated, we need to update the database schema, then re-export our config. We use drush_cmi_tools, so your commands may be different, e.g. just a drush config-export instead of drush cexy.
drush updb
drush cr
drush cexy
Settings.php
We also need to update our settings.php file now that The sync directory is defined in $settings and not $config_directories.
This is a trivial change from:
$config_directories['sync'] = 'foo/bar';
to:$settings['config_sync_directory'] = 'foo/bar';
Final Touches
In order to make sure our code is compatible with Drupal 9, we check for any custom code that is using deprecated APIs using the excellent PHPStan and Matt Glaman’s mglaman/phpstan-drupal. (Alternatively you can use Drupal Check.)
We were using an older version that was incompatible with “nette/bootstrap”:”>=3″ so needed to remove that from the conflict section and do the remove/require dance once again.
composer remove --dev
phpstan/phpstan-deprecation-rules
mglaman/phpstan-drupal
composer require --dev --update-with-dependencies
phpstan/phpstan-deprecation-rules:^0.11.2
mglaman/phpstan-drupal:^0.11.12
And that’s it! Altogether not too painful once the composer dependencies were all sorted out. As we are testing the beta, some of these issues may be addressed in future betas and RCs.
I hope you found this useful! Got a better solution? Let us know in the comments!