Drupal/Drush

From ThinkyWiki

Jump to: navigation, search

Contents

Common Drush Commands

pm-update (up)

This updates all outdated project code and runs update.php, basically bringing the site fully up-to-date. Modules that require additions and modifications will need to be fixed.

updatedb (updb)

Run the update.php script.

vget, vset, vdel

Get, set, and delete variables.

# drush help
Execute a drush command. Run `drush help [command]` to view command-specific help.  Run `drush topic` to read even more documentation.
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.


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.
 bam backup            Backup the site's database with Backup and Migrate.
 bam backups           Get a list of previously created backup files.
 bam destinations      Get a list of available destinations.
 bam profiles          Get a list of available settings profiles.
 bam restore           Restore the site's database with Backup and Migrate.
 bam sources           Get a list of available sources.
 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)
 core-topic (topic)    Read detailed documentation on a given topic.
 drupal-directory      Return path to a given module/theme directory. See --help for more details.
 (dd)
 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.
 generate-content      Creates content.
 (genc)
 generate-taxonomy     Creates taxonomy.
 (gent)
 generate-users        Creates users.
 (genu)
 help                  Print this help message. See `drush help help` for more options.
 image-flush           Flush all derived images for a given style.
 php-eval              Evaluate arbitrary php code after bootstrapping Drupal.
 php-script (scr)      Run php script(s).
 pm-disable (dis)      Disable one or more extensions (modules or themes).
 pm-download (dl)      Download projects from drupal.org or other sources.
 pm-enable (en)        Enable one or more extensions (modules or themes).
 pm-info               Show info for one or more modules or themes.
 pm-list (sm)          Show a list of available extensions (modules and themes).
 pm-refresh (rf)       Refresh update status information.
 pm-releasenotes       Print release notes for given projects.
 (rln)
 pm-releases           Print release information for given projects.
 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-drop              Drop all tables in a given database.
 sql-dump              Exports the Drupal DB as SQL using mysqldump or equivalent.
 sql-query (sqlq)      Execute a query against the site database.
 sql-sync              Copy source database to target database using rsync.
 test-clean            Clean temporary tables and files.
 test-run              Run tests. Note that you must use the --uri option.
 updatedb (updb)       Execute the update.php process from the command line
 user-add-role (urol)  Add a role to the specified user accounts.
 user-block (ublk)     Block the specified user(s).
 user-cancel (ucan)    Cancel a user account with the specified name.
 user-create (ucrt)    Create a user account with the specified name.
 user-information      Print information about the specified user(s).
 (uinf)
 user-login (uli)      Display a one time login link for the given user account (defaults to uid 1).
 user-password (upwd)  (Re)Set the password for the user account with the specified name.
 user-remove-role      Remove a role from the specified user accounts.
 (urrol)
 user-unblock (uublk)  Unblock the specified user(s).
 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.
 vbo-execute           Execute a bulk operation based on a Views Bulk Operations (VBO) view.
 vbo-list              List all Views Bulk Operations (VBO) views, along with the operations associated with each.
 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 messages.
 (wd-list)
 watchdog-show         Show watchdog messages.
 (wd-show, ws)
Personal tools