Skip to content

Instantly share code, notes, and snippets.

@Berdir
Last active March 29, 2021 07:51
Show Gist options
  • Save Berdir/3a6dfdc5331a5fa2393a4c86410d5953 to your computer and use it in GitHub Desktop.
Save Berdir/3a6dfdc5331a5fa2393a4c86410d5953 to your computer and use it in GitHub Desktop.
# Completely flush redis, old stuff is no longer relevant and wastes space, avoids any
# old state to influence update functions.
./vendor/bin/drush ev "\Drupal::service('redis.factory')->getClient()->flushAll()"
# Check if there are any updates to run.
if [ -n "$(./vendor/bin/drush updbst --format=list 2>/dev/null)" ]; then
# If so, then drush updb includes a drush cr, but separately clear css/js cache
# because due to memory cache backend during updates, it does not invalidate things properly.
./vendor/bin/drush updb -y
./vendor/bin/drush cc css-js
else
# If not then just rebuild specific things that are not in redis like routes and aggregated files.
./vendor/bin/drush cc router
./vendor/bin/drush cc render
./vendor/bin/drush cc css-js
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment