Saturday, March 30, 2013

Drush Commands

Core drush commands

archive-dumpBackup your code, files, and database into a single file.
archive-restoreExpand a site archive into a Drupal web site.
cache-clearClear a specific cache, or all drupal caches.
cache-getFetch a cached object and display it.
cache-setCache an object expressed in JSON or var_export() format.
core-configEdit drushrc, site alias, and Drupal settings.php files.
core-cronRun all cron hooks in all active modules for specified site.
core-executeExecute a shell command. Usually used with a site alias.
core-quick-drupalDownload, install, serve and login to Drupal with minimal configuration and dependencies.
core-requirementsProvides information about things that may be wrong in your Drupal installation, if any.
core-rsyncRsync the Drupal tree to/from another server using ssh.
core-statusProvides a birds-eye view of the current Drupal installation, if any.
core-topicRead detailed documentation on a given topic.
drupal-directoryReturn path to a given module/theme directory.
helpPrint this help message. See `drush help help` for more options.
image-flushFlush all derived images for a given style.
php-evalEvaluate arbitrary php code after bootstrapping Drupal (if available).
php-scriptRun php script(s).
queue-listReturns a list of all defined queues
queue-runRun a specific queue by name
search-indexIndex the remaining search items without wiping the index.
search-reindexForce the search index to be rebuilt.
search-statusShow how many items remain to be indexed out of the total.
self-updateCheck to see if there is a newer Drush release available.
shell-aliasPrint all known shell alias records.
site-aliasPrint site alias records for all known site aliases and local sites.
site-installInstall Drupal along with modules/themes/configuration using the specified install profile.
site-resetReset a persistently set site.
site-setSet a site alias to work on that will persist for the current session.
site-sshConnect to a Drupal site's server via SSH for an interactive session or to run a shell command
test-cleanClean temporary tables and files.
test-runRun tests. Note that you must use the --uri option.
updatedbApply any database updates required (as with running update.php).
usage-sendSend anonymous Drush usage information to statistics logging site. Usage statistics contain the Drush command name and the Drush option names, but no arguments or option values.
usage-showShow Drush usage information that has been logged but not sent. Usage statistics contain the Drush command name and the Drush option names, but no arguments or option values.
variable-deleteDelete a variable.
variable-getGet a list of some or all site variables and values.
variable-setSet a variable.
versionShow drush version.
watchdog-deleteDelete watchdog messages.
watchdog-listShow available message types and severity levels. A prompt will ask for a choice to show watchdog messages.
watchdog-showShow watchdog messages.

Runserver commands

runserverRuns a lightweight built in http server for development.

Field commands

field-cloneClone a field and all its instances.
field-createCreate fields and instances. Returns urls for field editing.
field-deleteDelete a field and its instances.
field-infoView information about fields, field_types, and widgets.
field-updateReturn URL for field editing web page.

Project manager commands

pm-disableDisable one or more extensions (modules or themes).
pm-downloadDownload projects from drupal.org or other sources.
pm-enableEnable one or more extensions (modules or themes).
pm-infoShow detailed info for one or more extensions (modules or themes).
pm-listShow a list of available extensions (modules and themes).
pm-refreshRefresh update status information.
pm-releasenotesPrint release notes for given projects.
pm-releasesPrint release information for given projects.
pm-uninstallUninstall one or more modules.
pm-updateUpdate Drupal core and contrib projects and apply any pending database updates (Same as pm-updatecode + updatedb).
pm-updatecodeUpdate Drupal core and contrib projects to latest recommended releases.

SQL commands

sql-cliOpen a SQL command-line interface using Drupal's credentials.
sql-connectA string for connecting to the DB.
sql-createCreate a database.
sql-dropDrop all tables in a given database.
sql-dumpExports the Drupal DB as SQL using mysqldump or equivalent.
sql-queryExecute a query against the site database.
sql-syncCopy and import source database to target database. Transfers via rsync.

User commands

user-add-roleAdd a role to the specified user accounts.
user-blockBlock the specified user(s).
user-cancelCancel a user account with the specified name.
user-createCreate a user account with the specified name.
user-informationPrint information about the specified user(s).
user-loginDisplay a one time login link for the given user account (defaults to uid 1).
user-password(Re)Set the password for the user account with the specified name.
user-remove-roleRemove a role from the specified user accounts.
user-unblockUnblock the specified user(s).

Other commands

makeTurns a makefile into a working Drupal codebase.
make-generateGenerate a makefile from the current Drupal site.

Global Options (see `drush topic core-global-options` for the full list)

-r <path>, --root=<path> Drupal root directory to use (default: current directory).
-l <http://example.com:8888>, --uri=<http://example.com:8888> URI of the drupal site to use (only needed in multisite environments or when running on an alternate port).
-v, --verbose Display extra information about the command.
-d, --debug Display even more information, including internal messages.
-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).
-p, --pipe Emit a compact representation of the command for scripting.
-h, --help This help system.
--version Show drush version.
--php=</path/to/file> The absolute path to your PHP intepreter, if not 'php' in the path.
-ia, --interactive Force interactive mode for commands run on multiple targets (e.g. `drush @site1,@site2 cc --ia`).


only show translated menu items into current language (Drupal 8)

function MY_THEME_preprocess_menu(&$variables) {   if ($variables['menu_name'] == 'brancott-header-menu') {    $langu...