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';
Also we need to move temporary files directory from config to settings.
$config['system.file']['path']['temporary'] = 'foo/bar';
to:
$settings['file_temp_path'] = '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!
Update: Added additional settings changes.
Comments
This may be relatively simple for a major development company, but it would not be easy for a more casual developer with a few small sites. Just recognizing what needs to be done is non-trivial. I am just playing with a D7 to D8 migrate at this point and it looks like I should delay until 8.8.0 to avoid some of the issues. Or will some of these issues still arise on a clean install?
Drupal 8.8.0 was released today - and yes, now would probably be a better time to start your D7 to D8 migrate. Just in general, it might not be bad to wait for an 8.8.1, just in case there are any other little clean ups that go in, of course.
Thanks for this post, it helped me through the update process by addressing important issues. What I did to get the missing dependencies that prohibited the update to 8.8.0 was running "composer update" instead of your suggestion in "Update Drupal Core and Friends". It just worked, any dependency was updated an so was core. In my case an older version of typo3/phar-stream-wrapper was the problem.
Thanks for the documentation! This was very helpful for such a tricky update.
Ironically, the change in temporary directory mentioned here isn't explicit in any CR and isn't in the guide on drupal.org (https://www.drupal.org/node/2700999).
I added a comment here: https://www.drupal.org/project/drupal/issues/3039026#comment-13390317
Thanks for this. I agree with Walt that Drupal updates are not easy for the casual developer, so we do appreciate the time taken to write and publish these articles. The 8.3 to 8.4 upgrade was a disaster for my project. With the help of this article, the official d.o 'special considerations' instructions and another article at https://www.palantir.net/blog/guide-drupal-8-8-update , I was able to move my drupal ecommerce project from 8.7 to 8.8 with relative ease. Still, upgrading drupal feels like a leap in the dark. There is no 'one size fits all' instruction. Backup everything, then be brave!
I have used a single cpmmand `composer update drupal/core "symfony/*" --with-dependencies` to update Drupal Core and Friends.
Would you also recommend removing 'drupal/core' as part of the soft dependency check?
This is one of the reasons why many persons hate composer in Drupal, i know it is usefull and use it on day to day, but each update from 8.6 to 8.7 to 8.8 we need a post like yours.
Comment by Walt Daniels
Dated