Drush hacking for fun and profit
Drupal Admin 101
Install or Upgrade a Module
Open drupal.org
Find your module, and the correct version
Download and uncompress project files
Go to site
click on Administer
Go to Modules, find our module in the list
Click the module checkbox
Click Save
Go back to step 1, rinse and repeat
Upgrade your Drupal 6 site
Open drupal.org
Download the latest version of Drupal
Back up your files, sites
Uncompress Drupal over your old Drupal
(or just move your sites and files dirs)
Go to site
Run update.php
D34DB33F:sql danielpacker$ drush help
Execute a drush command. Run `drush help [command]` to view command-specific help.
Examples:
drush dl cck zen Download CCK module and Zen theme.
drush --uri=http://example.com status Show status command for the example.com multi-site.
drush help --pipe A space delimited list of commands
Options:
-r <path>, --root=<path> Drupal root directory to use (default: current directory)
-l <uri>, --uri=http://example.com URI of the drupal site to use (only needed in multisite environments)
-v, --verbose Display extra information about the command.
-d, --debug Display even more information, including internal messages.
-q, --quiet Hide all output
-y, --yes Assume 'yes' as answer to all prompts
-n, --no Assume 'no' as answer to all prompts
-s, --simulate Simulate all relevant actions (don't actually change the system)
-i, --include A list of paths to search for drush commands
-c, --config Specify a config file to use. See example.drushrc.php
-u, --user Specify a user to login with. May be a name or a number.
-b, --backend Hide all output and return structured data (internal use only).
-p, --pipe Emit a compact representation of the command for scripting.
--nocolor Suppress color highlighting on log messages.
--show-passwords Show database passwords in commands that display connection information.
-h, --help This help system.
--php The absolute path to your PHP intepreter, if not 'php' in the path.
Commands:
cache-clear (cc) Clear a specific cache, or all drupal caches.
core-cli (cli) Enter a new shell optimized for drush use.
core-cron (cron) Run all cron hooks.
core-rsync (rsync) Rsync the Drupal tree to/from another server using ssh. Relative paths start from the Drupal root
folder if a site alias is used; otherwise they start from the current working directory.
core-status (status, Provides a birds-eye view of the current Drupal installation, if any.
st)
drupal-directory Return path to a given module/theme directory. See --help for more details.
(dd)
help Print this help message. Use --filter to limit command list to one command file (e.g. --filter=pm)
node Drush node command. Implements unix cmds for nodes.
php-eval Evaluate arbitrary php code after bootstrapping Drupal.
php-script (scr) Run php script(s).
pm-disable (dis) Disable one or more modules or themes.
pm-download (dl) Download core Drupal and projects like CCK, Zen, etc.
pm-enable (en) Enable one or more modules or themes.
pm-info Show info for one or more projects.
pm-list (sm) Show a list of available modules and themes
pm-refresh (rf) Refresh update status information
pm-releases Release information for a project
pm-uninstall Uninstall one or more modules.
pm-update (up) Update your project code and apply any database updates required (update.php)
pm-updatecode (upc) Update your project code
search-index Index the remaining search items without wiping the index.
search-reindex Force the search index to be rebuilt.
search-status Show how many items remain to be indexed out of the total.
site-alias (sa) Print site alias records for all known site aliases and local sites.
site-install (si) Install Drupal along with modules/themes/configuration using the specified install profile.
site-upgrade (sup) Run a major version upgrade for Drupal core and contrib modules.
sql-cli (sqlc) Open a SQL command-line interface using Drupal's credentials.
sql-conf Print database connection details using print_r().
sql-connect A string for connecting to the DB.
sql-dump Exports the Drupal DB as SQL using mysqldump.
sql-query (sqlq) Execute a query against the site database.
sql-sync Copy source database to target database using rsync.
updatedb (updb) Execute the update.php process from the command line
variable-delete Delete a variable.
(vdel)
variable-get (vget) Get a list of some or all site variables and values.
variable-set (vset) Set a variable.
watchdog-delete Delete watchdog messages.
(wd-del, wd-delete)
watchdog-list Show available message types and severity levels. A prompt will ask for a choice to show watchdog
(wd-list) messages.
watchdog-show Show watchdog messages.
(wd-show, ws)
From the command line
drush let's you...
Download modules and themes!
Enable and disable modules and themes!
See what modules and themes are installed!
Get information about modules on drupal.org/projects
Upgrade modules and themes!
Upgrade drupal versions!
Create a database dump!
Re-index your search!
Install a site using installation profiles!
Clear cache tables!
Run cron!
Much, much more!
What are the requirements
for the drush command file?
Command file must end in .drush.inc
Can live in ~/.drush
Can live in drush home
Can live in your module dirs
Drush command functions (hooks)
my_command_help()
my_command_command()
my_command_validate()
if not overridden:
my_command_subcommand_name()
In conclusion...
Drush makes everyday drupal admin tasks easy
Drush works across sites and networks
Drush makes it easy to automate drupal scripts
Creating a Drush command is super easy
Packaging a Drush command with your module is too
Use Drush any time you need to bootstrap drupal scripts
http://drupal.org/project/drush
FAQ
---
Q: What does "drush" stand for?
A: The Drupal Shell.
Q: How do I pronounce drush?
A: Some people pronounce the dru with a long u like drupal. Fidelity points go to
them, but they are in the minority. Most pronounce drush so that it rhymes with
hush, rush, flush, etc. This is the preferred pronunciation.
CREDITS
-------
Originally developed by Arto Bendiken <http://bendiken.net/> for Drupal 4.7.
Redesigned by Franz Heinzmann (frando) <http://unbiskant.org/> in May 2007 for Drupal 5.
Maintained by Moshe Weitzman <http://drupal.org/moshe> with much help from
Owen Barton, Adrian Rossouw, greg.1.anderson.More presentations by Daniel Packer
Popular presentations
Future-Proof Your Education
Maria Andersen on
How do you prepare for uncertain career paths where technical knowledge doubles every two years? You pay attention to the skills that surround the content: ...
More popular prezis in Explore>