Skip to content

Instantly share code, notes, and snippets.

@DuaelFr
Created November 5, 2015 11:00
Show Gist options
  • Save DuaelFr/9adcd288d5cbfa7f2c1f to your computer and use it in GitHub Desktop.
Save DuaelFr/9adcd288d5cbfa7f2c1f to your computer and use it in GitHub Desktop.
D8 update
#!/bin/bash
# Get the script's directory.
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )
# Go to the document root.
cd $DIR
cd ../www
# Ensure Drupal is already installed.
INSTALLED=$(drush status | grep "Drupal version" | wc -l)
if [ ! $INSTALLED ]
then
echo "Drupal is not installed, run install.sh instead"
exit 1
fi
echo "+ Back up the database"
drush sql-dump --result-file
echo "+ Enable maintenance mode"
drush sset system.maintenance_mode 1
echo "+ Update the code base"
git pull
echo "+ Clear caches and run database updates"
drush cache-rebuild
drush updatedb -y
echo "+ Import new and modified config"
drush config-import -y --partial
echo "+ Export config to get newly created config elements"
drush config-export -y
echo "+ Import all config to respect created and deleted elements"
drush config-import -y
echo "Update over."
echo "The website is still in maintenance mode. Once tested you can republish the website using the following command:"
echo "$ drush sset system.maintenance_mode 0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment