drush

Drupal Site Reset BASH Script

I'm experimenting with Drupal 8 and some its new features like migration and configuration management. A reset script is a convenient timesaver and many people have shared their techniques for doing so. Having benefited from other's generosity I wanted to return the favour by sharing my current work-in-progress.

This script:

Simple Drupal Remote Backup

Like many web types I have a number of small websites I look after, and I've never been happy with my backup solution. Until today.

My requirements are simple, create a backup of the database and files and save it on a local backup drive. The sites don't warrant anything fancy (like a cloud based solution that costs money). The procedure until now involved multiple, fussy steps. It turned out a single script solution is simple once a few key technologies are in place.

Drupal 7 Upgrades with Scripts and Drush

AutomationA Drupal upgrade between major versions rarely means doing the upgrade procedure once. A new configuration, changing content, or needing to test different module versions typically means redoing the upgrade from scratch a number of times, a tedious, error-prone and time consuming process. Fortunately there's a solution: automation!

Scripting was always possible, but Drush has made it so much simpler. What follows is a review of the Drush commands I used via script to upgrade my Group 42 website to Drupal 7. The hand full of shell commands are basic and covered many other places on the net. The full upgrade scripts are at the end of the post.

If you're familiar with Drush I recommend jumping directly to the scripts.

Drupal Command Line Scripts with Drush

Drupal's scripting abilities just keep getting better and better. Since publishing my Drupal Command Line Script Template last year I've moved exclusively to the Drush php-script (scr) command. The script template article still gets a lot of page views - perhaps because with all the functionality in Drush it's easy to miss the scripting feature - so posting an update seems like a good idea.

Drush Scripting Advantages/Disadvantages

The advantages of using Drush over using my original template are:

  • Drush takes care of creating the Drupal environment for the script to run in, which is the only function the template served. Using Drush factors out the environment common code, eliminating redundant code in individual scripts.
  • Drush makes it easy to place the script files in a directory outside of the Drupal website home directory. Placing script files outside the website home directory eliminates a whole range of security issues.
  • The Drush code that creates the Drupal environment is reviewed by the community, making it far more robust than something a single person could create or maintain on their own.
  • When the code required to create the Drupal environment changes you don't need to update individual templates, just Drush.

Subscribe to RSS - drush