Skip to main content

Update Drupal 8 core via Composer

Step 1. Backup both your files and database.

anisur$ drush archive-dump
Database dump saved to /tmp/drush_tmp_1547780785_5c4142b133eab/d8blog_new.sql            [success]
Archive saved to                                                                         [ok]
/Users/anisur/drush-backups/archive-dump/20190118030539/d8blog_new.20190118_030540.tar.gz 

Step 2. Check for available updates

anisur$ composer outdated drupal/*

drupal/bootstrap 3.16.0 3.17.0 Built to use Bootstrap, a sleek, intuitive, and powerful front-en...
drupal/core      8.6.5  8.6.7  Drupal is an open source content management platform powering mil...
One step update instruction
anisur$ composer update drupal/core --with-dependencies

> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
 

Step 3. Activate maintenance mode

anisur$ drush sset system.maintenance_mode 1

Step 4. Clear the cache

anisur$ drush cr
Cache rebuild complete.                                                                  [ok]

Step 5. Update Drupal 8 core

$ composer update drupal/core webflo/drupal-core-require-dev --with-dependencies
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 2 updates, 0 removals
  - Installing typo3/phar-stream-wrapper (v2.0.1): Loading from cache
  - Updating drupal/core (8.6.5 => 8.6.7): Loading from cache
Writing lock file
Generating autoload files
  - .csslintrc (https://cgit.drupalcode.org/drupal/plain/.csslintrc?h=8.6.7): Downloading (100%)         
  - .editorconfig (https://cgit.drupalcode.org/drupal/plain/.editorconfig?h=8.6.7): Downloading (100%)       - .eslintignore (https://cgit.drupalcode.org/drupal/plain/.eslintignore?h=8.6.7): Downloading (100%)       - .eslintrc.json (https://cgit.drupalcode.org/drupal/plain/.eslintrc.json?h=8.6.7): Downloading (100%)     - .gitattributes (https://cgit.drupalcode.org/drupal/plain/.gitattributes?h=8.6.7): Downloading (100%)     - .ht.router.php (https://cgit.drupalcode.org/drupal/plain/.ht.router.php?h=8.6.7): Downloading (100%)     - .htaccess (https://cgit.drupalcode.org/drupal/plain/.htaccess?h=8.6.7): Downloading (100%)         
  - index.php (https://cgit.drupalcode.org/drupal/plain/index.php?h=8.6.7): Downloading (100%)         
  - robots.txt (https://cgit.drupalcode.org/drupal/plain/robots.txt?h=8.6.7): Downloading (100%)         
  - sites/default/default.services.yml (https://cgit.drupalcode.org/drupal/plain/sites/default/default.services.yml?h=8.6.7): Downloading (100%)         
  - sites/default/default.settings.php (https://cgit.drupalcode.org/drupal/plain/sites/default/default.settings.php?h=8.6.7): Downloading (100%)         
  - sites/development.services.yml (https://cgit.drupalcode.org/drupal/plain/sites/development.services.yml?h=8.6.7): Downloading (100%)         
  - sites/example.settings.local.php (https://cgit.drupalcode.org/drupal/plain/sites/example.settings.local.php?h=8.6.7): Downloading (100%)         
  - sites/example.sites.php (https://cgit.drupalcode.org/drupal/plain/sites/example.sites.php?h=8.6.7): Downloading (100%)         
  - update.php (https://cgit.drupalcode.org/drupal/plain/update.php?h=8.6.7): Downloading (100%)         
  - web.config (https://cgit.drupalcode.org/drupal/plain/web.config?h=8.6.7): Downloading (100%)         
> DrupalProject\composer\ScriptHandler::createRequiredFiles

Step 5. Update Databse

anisur$ drush updb
No database updates required                                                             [success]

Step 6. Deactivate maintenance mode

anisur$ drush sset system.maintenance_mode 0

Step 7. Clear the cache again

anisur$ drush cr
Cache rebuild complete.                                                                  [ok]
Back to top