Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Upgrade Drupal core via Composer

carolyncole edited this page Mar 22, 2022 · 9 revisions

Upgrading Drupal via Composer

See for more information: https://www.drupal.org/docs/updating-drupal/updating-drupal-core-via-composer It is preferred for you to run this on your local system and to deploy the upgrade to the servers, but there are instructions for running it on a server also.

On Your local System

  1. Pull the production database (This assumes you have followed the configuration steps in the README.md

    lando drush @researchdata.prod sql-dump --structure-tables-list='watchdog,sessions,cas_data_login,history,captcha_sessions,cache,cache_*' --result-file=/tmp/dump.sql
    scp pulsys@prds-prod1:/tmp/dump.sql .
    lando db-import dump.sql
    lando drush cache:rebuild
    
  2. Commit any changes utilizing the instructions from the README

  3. Update Drupal

    lando composer outdated "drupal/*"
    lando composer update drupal/core-recommended --with-all-dependencies
    

    you may also want to update more components than just the recommended

    lando composer update drupal --with-all-dependencies
    
  4. Drop any changes to the README.md

    git checkout sites/README.txt 
    
  5. Also check if updates to .htaccess or robots.txt conflict. Usually these changes should also be discarded, but you should look at them to determine if they need to be kept.

    git diff .htaccess 
    git diff robots.txt 
    git checkout .htaccess 
    git checkout robots.txt 
    
  6. You may need to run an updatedb and a cache rebuild. These do no harm if they are no needed, but if an updatedb is needed locally it will likely also be needed on the servers after a deploy:

    lando drush updatedb
    lando drush cache:rebuild
    

On the server (This is not recommended but can be done in a pinch...

composer outdated "drupal/*"
composer update drupal/core-recommended --with-all-dependencies
git check out sites/README.txt 

Also check if updates to .htaccess or robots.txt conflict

As needed:

drush updatedb
drush cache:rebuild