Upgrade Drupal core from 9.4.8 to 9.5.0 (Acquia Cloud IDE + Acquia Cloud Platform)

I’m using my Acquia Cloud IDE instance, but you should be able to follow these steps on your local Drupal development instance.

Open the terminal and go to your application root folder:

drush status

To update your site to Drupal core 9.5.0 execute the following composer command:

composer require drupal/core-recommended:9.5.0 drupal/core-composer-scaffold:9.5.0 drupal/core-project-message:9.5.0 --update-with-all-dependencies

Terminal results:

My Cloud IDE:~/project (new-site *) $ composer require drupal/core-recommended:9.5.0 drupal/core-composer-scaffold:9.5.0 drupal/core-project-message:9.5.0 --update-with-all-dependencies
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been updated
Running composer update drupal/core-recommended drupal/core-composer-scaffold drupal/core-project-message --with-all-dependencies
Gathering patches for root package.
No patches supplied.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 33 updates, 0 removals
  - Upgrading doctrine/instantiator (1.4.1 => 1.5.0)
  - Upgrading drupal/core (9.4.8 => 9.5.0)
  - Upgrading drupal/core-composer-scaffold (9.4.8 => 9.5.0)
  - Locking drupal/core-project-message (9.5.0)
  - Upgrading drupal/core-recommended (9.4.8 => 9.5.0)
  - Upgrading egulias/email-validator (3.2.1 => 3.2.4)
  - Upgrading laminas/laminas-diactoros (2.11.3 => 2.14.0)
  - Upgrading laminas/laminas-stdlib (3.7.1 => 3.11.0)
  - Upgrading nikic/php-parser (v4.15.1 => v4.15.2)
  - Upgrading phpunit/php-code-coverage (9.2.18 => 9.2.23)
  - Upgrading phpunit/phpunit (9.5.26 => 9.5.27)
  - Upgrading symfony/console (v4.4.47 => v4.4.49)
  - Upgrading symfony/dependency-injection (v4.4.44 => v4.4.49)
  - Upgrading symfony/finder (v5.4.11 => v5.4.17)
  - Upgrading symfony/http-client (v4.4.46 => v4.4.49)
  - Upgrading symfony/http-foundation (v4.4.46 => v4.4.49)
  - Upgrading symfony/http-kernel (v4.4.46 => v4.4.49)
  - Upgrading symfony/polyfill-ctype (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-iconv (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-intl-grapheme (v1.26.0 => v1.27.0)
  - Upgrading symfony/polyfill-intl-idn (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-intl-normalizer (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-mbstring (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-php72 (v1.26.0 => v1.27.0)
  - Upgrading symfony/polyfill-php73 (v1.26.0 => v1.27.0)
  - Upgrading symfony/polyfill-php80 (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-php81 (v1.26.0 => v1.27.0)
  - Upgrading symfony/psr-http-message-bridge (v2.1.3 => v2.1.4)
  - Upgrading symfony/serializer (v4.4.45 => v4.4.47)
  - Upgrading symfony/string (v5.4.14 => v5.4.17)
  - Upgrading symfony/translation (v4.4.45 => v4.4.47)
  - Upgrading symfony/validator (v4.4.46 => v4.4.48)
  - Upgrading symfony/var-dumper (v5.4.14 => v5.4.17)
  - Upgrading twig/twig (v2.15.3 => v2.15.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 33 updates, 0 removals
  - Downloading drupal/core-composer-scaffold (9.5.0)
  - Downloading drupal/core-project-message (9.5.0)
  - Downloading symfony/polyfill-ctype (v1.27.0)
  - Downloading symfony/polyfill-php80 (v1.27.0)
  - Downloading symfony/polyfill-php73 (v1.27.0)
  - Downloading symfony/polyfill-mbstring (v1.27.0)
  - Downloading symfony/polyfill-php72 (v1.27.0)
  - Downloading symfony/polyfill-intl-normalizer (v1.27.0)
  - Downloading symfony/polyfill-intl-idn (v1.27.0)
  - Downloading symfony/http-foundation (v4.4.49)
  - Downloading symfony/var-dumper (v5.4.17)
  - Downloading symfony/http-kernel (v4.4.49)
  - Downloading symfony/http-client (v4.4.49)
  - Downloading symfony/dependency-injection (v4.4.49)
  - Downloading symfony/console (v4.4.49)
  - Downloading symfony/polyfill-php81 (v1.27.0)
  - Downloading symfony/finder (v5.4.17)
  - Downloading twig/twig (v2.15.4)
  - Downloading symfony/validator (v4.4.48)
  - Downloading symfony/translation (v4.4.47)
  - Downloading symfony/serializer (v4.4.47)
  - Downloading symfony/psr-http-message-bridge (v2.1.4)
  - Downloading symfony/polyfill-iconv (v1.27.0)
  - Downloading laminas/laminas-stdlib (3.11.0)
  - Downloading laminas/laminas-diactoros (2.14.0)
  - Downloading egulias/email-validator (3.2.4)
  - Downloading drupal/core (9.5.0)
  - Downloading nikic/php-parser (v4.15.2)
  - Downloading symfony/polyfill-intl-grapheme (v1.27.0)
  - Downloading symfony/string (v5.4.17)
  - Downloading phpunit/php-code-coverage (9.2.23)
  - Downloading doctrine/instantiator (1.5.0)
  - Downloading phpunit/phpunit (9.5.27)
Gathering patches for root package.
No patches supplied.
Gathering patches for dependencies. This might take a minute.
  - Upgrading drupal/core-composer-scaffold (9.4.8 => 9.5.0): Extracting archive
drupal/core-project-message contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "drupal/core-project-message" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y
  - Installing drupal/core-project-message (9.5.0): Extracting archive
  - Upgrading symfony/polyfill-ctype (v1.25.0 => v1.27.0): Extracting archive
  - Upgrading symfony/polyfill-php80 (v1.25.0 => v1.27.0): Extracting archive
  - Upgrading symfony/polyfill-php73 (v1.26.0 => v1.27.0): Extracting archive
  - Upgrading symfony/polyfill-mbstring (v1.25.0 => v1.27.0): Extracting archive
  - Upgrading symfony/polyfill-php72 (v1.26.0 => v1.27.0): Extracting archive
  - Upgrading symfony/polyfill-intl-normalizer (v1.25.0 => v1.27.0): Extracting archive
  - Upgrading symfony/polyfill-intl-idn (v1.25.0 => v1.27.0): Extracting archive
  - Upgrading symfony/http-foundation (v4.4.46 => v4.4.49): Extracting archive
  - Upgrading symfony/var-dumper (v5.4.14 => v5.4.17): Extracting archive
  - Upgrading symfony/http-kernel (v4.4.46 => v4.4.49): Extracting archive
  - Upgrading symfony/http-client (v4.4.46 => v4.4.49): Extracting archive
  - Upgrading symfony/dependency-injection (v4.4.44 => v4.4.49): Extracting archive
  - Upgrading symfony/console (v4.4.47 => v4.4.49): Extracting archive
  - Upgrading symfony/polyfill-php81 (v1.26.0 => v1.27.0): Extracting archive
  - Upgrading symfony/finder (v5.4.11 => v5.4.17): Extracting archive
  - Upgrading twig/twig (v2.15.3 => v2.15.4): Extracting archive
  - Upgrading symfony/validator (v4.4.46 => v4.4.48): Extracting archive
  - Upgrading symfony/translation (v4.4.45 => v4.4.47): Extracting archive
  - Upgrading symfony/serializer (v4.4.45 => v4.4.47): Extracting archive
  - Upgrading symfony/psr-http-message-bridge (v2.1.3 => v2.1.4): Extracting archive
  - Upgrading symfony/polyfill-iconv (v1.25.0 => v1.27.0): Extracting archive
  - Upgrading laminas/laminas-stdlib (3.7.1 => 3.11.0): Extracting archive
  - Upgrading laminas/laminas-diactoros (2.11.3 => 2.14.0): Extracting archive
  - Upgrading egulias/email-validator (3.2.1 => 3.2.4): Extracting archive
  - Upgrading drupal/core (9.4.8 => 9.5.0): Extracting archive
  - Upgrading drupal/core-recommended (9.4.8 => 9.5.0)
  - Upgrading nikic/php-parser (v4.15.1 => v4.15.2): Extracting archive
  - Upgrading symfony/polyfill-intl-grapheme (v1.26.0 => v1.27.0): Extracting archive
  - Upgrading symfony/string (v5.4.14 => v5.4.17): Extracting archive
  - Upgrading phpunit/php-code-coverage (9.2.18 => 9.2.23): Extracting archive
  - Upgrading doctrine/instantiator (1.4.1 => 1.5.0): Extracting archive
  - Upgrading phpunit/phpunit (9.5.26 => 9.5.27): Extracting archive
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Generating autoload files
89 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed
Scaffolding files for drupal/core:
  - Copy [project-root]/.gitattributes from assets/scaffold/files/gitattributes
  - Copy [web-root]/.htaccess from assets/scaffold/files/htaccess
  - Copy [web-root]/robots.txt from assets/scaffold/files/robots.txt
  - Copy [web-root]/web.config from assets/scaffold/files/web.config
  - Copy [web-root]/sites/example.settings.local.php from assets/scaffold/files/example.settings.local.php
  - Skip [web-root]/sites/default/default.services.yml: overridden in acquia/drupal-recommended-project
  - Skip [web-root]/sites/default/default.settings.php: overridden in acquia/drupal-recommended-project
Scaffolding files for acquia/drupal-recommended-project:
  - Skip [profile-root]/.editorconfig: disabled
  - Skip [profile-root]/.gitattributes: disabled
  - Skip [profile-root]/.travis.yml: disabled
  - Skip [profile-root]/acquia-pipelines.yml: disabled
  - Skip [web-root]/sites/default/default.services.yml because it already exists and overwrite is false.
  - Skip [web-root]/sites/default/default.settings.php because it already exists and overwrite is false.
No security vulnerability advisories found
My Cloud IDE:~/project (new-site *) $ 

Check and apply any required database updates:

drush updb

Make sure your site was upgraded correctly:

drush status

Log in to your site using your credentials or generate an access token link using drush uli:

drush uli

Go to the “Status report” page (Reports/Status Report) and check for any errors and warnings:

Apparently my Acquia Cloud IDE instance is running PHP 7.4 even though my three environments on my Acquia Cloud Platform are configured to use PHP 8.0.

To change the PHP version of my Acquia Cloud IDE instance to PHP 8.0, I was required to execute the following command:

acli ide:php-version 8.0

After executing “drush cr” to clear the cache, I refreshed the “Site report” page and now I don’t have any error messages:

It’s time to export all configuration changes and commit the codebase changes to git:

drush cex

Commit and push your changes to your Git repository:

git status
git add -A
git commit -m "Upgraded Drupal core from 9.4.8 to 9.5.0"
git push

I will merge my new-site branch into Master:

git checkout master
git merge new-site

Create a git tag to save a snapshot of your current codebase. Git tags are similar to snapshots of the code, frozen in time. The Acquia Cloud Platform interface doesn’t allow you to make commits on a tag. By not modifying tags, you can easily go back to a previous tag if an error is discovered on the most recent tag.

git tag -a leo-1.1.1 -m "Upgraded Drupal core from 9.4.8 to 9.5.0"
git push --tags

Pushing your changes back to Acquia Cloud Platform

Pushing your code

Running acli push:code will not push your code to the Cloud Platform. Instead, it will recommend you use Git, which is following best practices, and the only way to update your code on the Cloud Platform.

ide:~/project (master) $ acli push:code
Please use git to push code changes upstream.

Pushing your database

Running acli push:database will allow you to push the Cloud IDE database to any non-production Cloud Platform environment and target database.

acli push:database

Pushing your files

Running acli push:files will allow you to push the Cloud IDE files to any non-production Cloud Platform environment and target files directory.

acli push:files

Change the codebase of your Dev environment

Go to the environments page of your Acquia Cloud Platform account and click the “Switch Code” icon of your Dev environment:

Select your new Tag and click the “Continue” button:

Click the “Switch” button to confirm your choice:

Wait for the code deployment to finish and then go to your Dev site to see the results: