Submitted by Dale on July 23, 2010 - 8:16am
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.
Submitted by Dale on March 23, 2009 - 11:09am