Skip to main content

Updating to Drupal 8.8.0 Beta with Composer

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.

by Kim Pepper /

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/findersymfony/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.

Posted by Kim Pepper
Technical Director

Dated

Comments

Comment by Walt Daniels

Dated

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?

Comment by hestenet

Dated

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.

Comment by Axel

Dated

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.

Comment by Dan

Dated

Thanks for the documentation! This was very helpful for such a tricky update.

Pagination

Add new comment

Restricted HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <h4> <h5> <h6>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Not sure where to start? Try typing "hello" or "help" if you get stuck.