You are hereBlogs / moshe weitzman's blog / What's new in Drush 4

What's new in Drush 4


By moshe weitzman - Posted on 17 March 2011

The Drush project has been on fire in the past year. In January, we released Drush 4. I realize that we never properly introduced it. So, here are the highlights ...

Much more documentation

Like most unix commands, Drush has always had pretty strong command specific help. Just append --help to any command and you learn much of what it can do. In Drush 4, we added 14 topics and examples which are long-form help that's usually not related to a single command. For example, we discuss site aliases and the Drush bootstrap. The new command topic is your tool for reading these docs. Topics are just text files, and modules/commandfiles can easily ship with them.

User Management

Adrian Rollett (acrollet) contributed 9 handy commands for managing user accounts on your Drupal site. Dealing with spammers or setting up new staff has never been quicker:

  • user-add-role. Add a role to the specified user accounts.
  • user-block. Block the specified user(s).
  • user-cancel. Cancel a user account with the specified name.
  • user-create. Create a user account with the specified name.
  • user-information. Print information about the specified user(s).
  • user-login. Display a one time login link for the given user account
  • user-password. Set the password for the user with the specified name.
  • user-remove-role. Remove a role from the specified user accounts.
  • user-unblock. Unblock the specified user(s).

Field Manager

Moshe Weitzman (that's me) added 5 commands specific to Drupal 7's Field API. In particular, they try to take some drudgery out of populating a content type with a bunch of Fields. These Drush commands get you started quickly. Some GUI work is often needed to configure the instances, formatters and widgets. The commands are:

  • field-clone. Clone a field and all its instances.
  • field-create. Create fields and instances. Returns urls for field editing.
  • field-delete. Delete a field and its instances.
  • field-info. View information about fields, field_types, and widgets.
  • field-update. Return URL for field editing web page.

Project Manager (pm)

The beloved project manager commands were enriched significantly during this release cycle. I'd like to thank Jonathan AraƱa Cruz (jonhattan), who did an awesome job as the maintainer of these commands.

  • pm-download. This command, better known as dl, quickly downloads projects from drupal.org or feature servers. In Drush 4, we added:
    • --notes option shows release notes after downloading projects.
    • --select option asks you to choose from a few recent releases or the development snapshot release. --select --all lets you choose from all available releases for a given version of Drupal.
  • pm-updatecode. This command updates some or all of your projects to their latest recommended release. In Drush 4 we added:
    • --lock. Pin a project at its current release such that pm-updatecode will skip pending updates.
    • --security-only. Only update projects that have security releases pending.
    • --show release notes after updating projects.
    • Drush checks for pending releases of itself and asks you to run selfupdate if any are pending.
  • pm-enable, pm-disable, pm-uninstall. You may now use wildcards when specifying extensions (aka modules/themes). For example, drush en views* uc*.

The above commands are now integrated with git.drupal.org so that you can optionally use git clones instead of tarballs. Lets all work together at http://groups.drupal.org/node/93449 so that Drush can help bring consistent, deep git.drupal.org integration to our sites.

SQL

We tweaked our SQL commands this release cycle. Perhaps you will enjoy …

  • sql-dump gets a new --gzip which compresses your DB backup file.
  • sql-sync is a jaw dropping time saver., It dumps, transfers, and loads your database from one server to another. new in Drush 4 is --sanitize, an optional phase for stripping sensitive information such as passwords and emails from database. Modules and commandfiles can do additional stripping as needed.
  • sql-drop. A new command to drop all tables in your current database.

Finally, we added support for SQLite and MSSQL, for those awesome Drupal 7 sites that prefer alternative database platforms.

Core

  • selfupdate. A new command which updates Drush itself when a new release is pending.
  • core-cli. A custom shell environment thats optimized for Drush.
    —pipe. Show all the nifty .bashrc code that this shell uses so that you import it into your usual shell. Very useful.
  • image-flush. Delete all image styles (D7 only). A companion command to pre-generate image styles would be nice for Drush 5.
  • php-script. Drush scripts are a lightweight alternative to Drush commands. Drush commands are not heavy weight at all but CLI developers can be extraordinarily lazy :) ... Scripts may now be standalone files that can be directly called from the CLI. That works because of their shebang line (first line). See examples/helloworld.script for an example. These Drush scripts have easy access to any CLI arguments that were used.
  • site-install. Programmatically install Drupal 6 (new) or Drupal 7 site. Can use any install profile or language.
  • site-upgrade. Fully automated upgrade script from Drupal 6 to Drupal 7. Re-run this command over and over as you tweak your update functions and available modules. Saves a lot of time.
  • test-run. Run some or all of the simpletest tests found in your site.

Maintainers

In addition to those people I've mentioned, thanks to Greg Anderson (greg.1.anderson) for many contributions such as standalone Drush scripts (see php-script), core-cli functionality in your own shell, --sanitize for sql-sync, and boatloads of documentation. Finally, Mark Sonnabaum (msonnabaum) has accepted my request for him to be the Drush 4 branch maintainer. Thanks for your service, Mark.

Tags

It's hugely admired and appreciated. Cheers!

good news, thanks for your work guys

Guys these are awesome news. This project is saving me a lot of time and I want to say you a very big thanks.

These additions are a lot helpful and will save even more time. Thank you again!

All you folks maintaining drush are my heroes *swoon*

Awesome! Thanks x 3!

OMG-- those field commands are going to be life savers. I'm working on a project now that involved dozens of fields per content type and being able to clone/create from drush instead for waiting for the ui to finish spinning is going to save TONS (literally) of time. moshe ftw