example.drushrc.php

  1. 8.0.x examples/example.drushrc.php
  2. 6.x examples/example.drushrc.php
  3. 7.x examples/example.drushrc.php
  4. 3.x examples/example.drushrc.php
  5. 4.x examples/example.drushrc.php
  6. 5.x examples/example.drushrc.php
  7. master examples/example.drushrc.php

Examples of valid statements for a Drush runtime config (drushrc) file.

Use this file to cut down on typing out lengthy and repetitive command line options in the Drush commands you use and to avoid mistakes.

Rename this file to drushrc.php and optionally copy it to one of the places listed below in order of precedence:

1. Drupal site folder (e.g. sites/{default|example.com}/drushrc.php). 2. Drupal /drush and sites/all/drush folders, or the /drush folder in the directory above the Drupal root. 3. In any location, as specified by the --config (-c) option. 4. User's .drush folder (i.e. ~/.drush/drushrc.php). 5. System wide configuration folder (e.g. /etc/drush/drushrc.php). 6. Drush installation folder.

If a configuration file is found in any of the above locations, it will be loaded and merged with other configuration files in the search list.

If you have some configuration options that are specific to a particular version of Drush, then you may place them in a file called drush5rc.php. The version-specific file is loaded in addition to, and after, the general- purpose drushrc file. Version-specific configuration files can be placed in any of the locations specified above.

IMPORTANT NOTE regarding configuration file on Windows:

For Windows 7, Windows Vista, Windows Server 2008 and later versions is the system window configuration folder C:\ProgramData\Drush. For previous versions of Windows is the folder C:\Documents and Settings\All Users\Drush.

IMPORTANT NOTE on configuration file loading:

At its core, Drush works by "bootstrapping" the Drupal environment in very much the same way that is done during a normal page request from the web server, so most Drush commands run in the context of a fully-initialized website.

Configuration files are loaded in the reverse order they are shown above. All configuration files are loaded in the first bootstrapping phase, but a configuration file in a specific Drupal site folder other than the default (eg, sites/example.com/drushrc.php) will not be loaded unless a specific Drupal site is selected. However, it _will_ be loaded if a site is selected (either via the current working directory or by use of the --uri option), even if the Drush command being run does not bootstrap to the Drupal Site phase.

The Drush commands 'rsync' and 'sql-sync' are special cases. These commands will load the configuration file for the site specified by the source parameter; however, they do not load the configuration file for the site specified by the destination parameter, nor do they load configuration files for remote sites.

See `drush topic docs-bootstrap` for more information on how bootstrapping affects the loading of Drush configuration files.

File

examples/example.drushrc.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Examples of valid statements for a Drush runtime config (drushrc) file.
  5. *
  6. * Use this file to cut down on typing out lengthy and repetitive command line
  7. * options in the Drush commands you use and to avoid mistakes.
  8. *
  9. * Rename this file to drushrc.php and optionally copy it to one of the places
  10. * listed below in order of precedence:
  11. *
  12. * 1. Drupal site folder (e.g. sites/{default|example.com}/drushrc.php).
  13. * 2. Drupal /drush and sites/all/drush folders, or the /drush folder
  14. * in the directory above the Drupal root.
  15. * 3. In any location, as specified by the --config (-c) option.
  16. * 4. User's .drush folder (i.e. ~/.drush/drushrc.php).
  17. * 5. System wide configuration folder (e.g. /etc/drush/drushrc.php).
  18. * 6. Drush installation folder.
  19. *
  20. * If a configuration file is found in any of the above locations, it will be
  21. * loaded and merged with other configuration files in the search list.
  22. *
  23. * If you have some configuration options that are specific to a particular
  24. * version of Drush, then you may place them in a file called drush5rc.php.
  25. * The version-specific file is loaded in addition to, and after, the general-
  26. * purpose drushrc file. Version-specific configuration files can be placed
  27. * in any of the locations specified above.
  28. *
  29. * IMPORTANT NOTE regarding configuration file on Windows:
  30. *
  31. * For Windows 7, Windows Vista, Windows Server 2008 and later versions is the
  32. * system window configuration folder C:\ProgramData\Drush. For previous
  33. * versions of Windows is the folder C:\Documents and Settings\All Users\Drush.
  34. *
  35. * IMPORTANT NOTE on configuration file loading:
  36. *
  37. * At its core, Drush works by "bootstrapping" the Drupal environment in very
  38. * much the same way that is done during a normal page request from the web
  39. * server, so most Drush commands run in the context of a fully-initialized
  40. * website.
  41. *
  42. * Configuration files are loaded in the reverse order they are shown above. All
  43. * configuration files are loaded in the first bootstrapping phase, but
  44. * a configuration file in a specific Drupal site folder other than the default
  45. * (eg, sites/example.com/drushrc.php) will not be loaded unless a specific
  46. * Drupal site is selected. However, it _will_ be loaded if a site is selected
  47. * (either via the current working directory or by use of the --uri option),
  48. * even if the Drush command being run does not bootstrap to the Drupal Site
  49. * phase.
  50. *
  51. * The Drush commands 'rsync' and 'sql-sync' are special cases. These commands
  52. * will load the configuration file for the site specified by the source
  53. * parameter; however, they do not load the configuration file for the site
  54. * specified by the destination parameter, nor do they load configuration files
  55. * for remote sites.
  56. *
  57. * See `drush topic docs-bootstrap` for more information on how bootstrapping
  58. * affects the loading of Drush configuration files.
  59. */
  60. // Specify the base_url that should be used when generating links
  61. # $options['l'] = 'http://example.com/subdir';
  62. // Specify your Drupal core base directory (useful if you use symlinks).
  63. # $options['r'] = '/home/USER/workspace/drupal-6';
  64. /**
  65. * Useful shell aliases:
  66. *
  67. * Drush shell aliases act similar to git aliases. For best results, define
  68. * aliases in one of the drushrc file locations between #3 through #6 above.
  69. * More information on shell aliases can be found via:
  70. * `drush topic docs-shell-aliases` on the command line.
  71. *
  72. * @see https://git.wiki.kernel.org/index.php/Aliases#Advanced
  73. */
  74. # $options['shell-aliases']['pull'] = '!git pull'; // We've all done it.
  75. # $options['shell-aliases']['pulldb'] = '!git pull && drush updatedb';
  76. # $options['shell-aliases']['cpull'] = 'config-pull @example.prod @self --label=vcs';
  77. # $options['shell-aliases']['noncore'] = 'pm-list --no-core';
  78. # $options['shell-aliases']['wipe'] = 'cache-clear all';
  79. # $options['shell-aliases']['unsuck'] = 'pm-disable -y overlay,dashboard';
  80. # $options['shell-aliases']['offline'] = 'variable-set -y --always-set maintenance_mode 1';
  81. # $options['shell-aliases']['online'] = 'variable-delete -y --exact maintenance_mode';
  82. # $options['shell-aliases']['dis-all'] = '!drush -y dis `drush pml --status=enabled --type=module --no-core --pipe`';
  83. # $options['shell-aliases']['self-alias'] = 'site-alias @self --with-db --alias-name=new';
  84. # $options['shell-aliases']['site-get'] = '@none php-eval "return drush_sitealias_site_get();"';
  85. // Add a 'pm-clone' to simplify git cloning from drupal.org.
  86. # $options['shell-aliases']['pm-clone'] = 'pm-download --gitusername=YOURUSERNAME --package-handler=git_drupalorg';
  87. // Load a drushrc.php configuration file from the current working directory.
  88. # $options['config'][] = './drushrc.php';
  89. /**
  90. * By default, Drush will download projects compatible with the current
  91. * version of Drupal, or, if no Drupal site is specified, then the Drupal-8
  92. * version of the project is downloaded. Set default-major to select a
  93. * different default version.
  94. */
  95. # $options['default-major'] = 7;
  96. // Clone extensions (modules, themes, etc.) from drupal.org via 'pm-download'.
  97. # $options['package-handler'] = 'git_drupalorg';
  98. /**
  99. * Specify folders to search for Drush command files (*.drush.inc). These
  100. * values are always merged with include paths defined on the command line or
  101. * in other configuration files. On the command line, paths may be separated
  102. * by a colon (:) on Unix-based systems or a semi-colon (;) on Windows.
  103. */
  104. # $options['include'] = array('/path/to/commands','/path2/to/more/commands');
  105. /**
  106. * Specify the modules to ignore when searching for command files (*.drush.inc)
  107. * inside a Drupal site.
  108. */
  109. # $options['ignored-modules'] = array('module1', 'module2');
  110. /**
  111. * Specify the folders to search for Drush alias files (*.alias.drushrc.php and
  112. * *.aliases.drushrc.php). These values are always merged with alias paths
  113. * defined on the command line or in other configuration files. On the command
  114. * line, paths may be separated by a colon (:) on Unix-based systems or a
  115. * semi-colon (;) on Windows.
  116. */
  117. # $options['alias-path'] = array('/path/to/aliases','/path2/to/more/aliases');
  118. /**
  119. * Specify the filename and path where 'sql-dump' should store backups of
  120. * database dumps. The default is to dump to STDOUT, however if this option is
  121. * set in a drushrc.php file, the default behaviour can be achieved by
  122. * specifying a value of FALSE ("--result-file=0" on the command line). Two
  123. * substitution tokens are available: @DATABASE is replaced with the name of the
  124. * database being dumped, and @DATE is replaced with the current time and date
  125. * of the dump of the form: YYYYMMDD_HHMMSS. A value of TRUE ("--result-file=1"
  126. * on the command line) will cause 'sql-dump' to use the same temporary backup
  127. * location as 'pm-updatecode'.
  128. */
  129. # $options['result-file'] = TRUE;
  130. # $options['result-file'] = '/path/to/backup/dir/@DATABASE_@DATE.sql';
  131. // Notify user via Notification Center (OSX) or libnotify (Linux) when command
  132. // takes more than 30 seconds. See global options for more configuration.
  133. # $options['notify'] = 30;
  134. // Enable verbose mode.
  135. # $options['v'] = 1;
  136. // Show database passwords in 'status' and 'sql-conf' commands.
  137. # $options['show-passwords'] = 1;
  138. /**
  139. * Specify the logging level for PHP notices. Defaults to "notice". Set to
  140. * "warning" when doing Drush development. Also make sure that error_reporting
  141. * is set to E_ALL in your php configuration file. See `drush status` for the
  142. * path to your php.ini file.
  143. */
  144. # $options['php-notices'] = 'warning';
  145. /**
  146. * Specify options to pass to ssh in backend invoke. The default is to prohibit
  147. * password authentication, and is included here, so you may add additional
  148. * parameters without losing the default configuration.
  149. */
  150. # $options['ssh-options'] = '-o PasswordAuthentication=no';
  151. // Set 'remote-os' to 'Windows' to make Drush use Windows shell escape rules
  152. // for remote sites that do not have an 'os' item set.
  153. # $options['remote-os'] = 'Linux';
  154. // By default, unknown options are disallowed and result in an error. Change
  155. // them to issue only a warning and let command proceed.
  156. # $options['strict'] = FALSE;
  157. /**
  158. * Drush requires at least rsync version 2.6.9 for some functions to work
  159. * correctly. rsync version 2.6.8 or earlier may give the following error
  160. * message: "--remove-source-files: unknown option". To fix this, set
  161. * $options['rsync-version'] = '2.6.8'; (replace with the lowest version of
  162. * rsync installed on any system you are using with Drush). Note that this
  163. * option can also be set in a site alias, which is the preferred solution if
  164. * newer versions of rsync are available on some of the systems you use.
  165. * See: http://drupal.org/node/955092
  166. */
  167. # $options['rsync-version'] = '2.6.9';
  168. /**
  169. * The output charset suitable to pass to the iconv PHP function's out_charset
  170. * parameter.
  171. *
  172. * Drush will convert its output from UTF-8 to the charset specified here. It
  173. * is possible to use //TRANSLIT and //IGNORE charset name suffixes (see iconv
  174. * documentation). If not defined, conversion will not be performed.
  175. */
  176. # $options['output_charset'] = 'ISO-8859-1';
  177. # $options['output_charset'] = 'KOI8-R//IGNORE';
  178. # $options['output_charset'] = 'ISO-8859-1//TRANSLIT';
  179. /**
  180. * Multiple-site execution options:
  181. *
  182. * Some drush commands such as 'sql-sync' are intended for or capable of being
  183. * executed on multiple sites or server environments and will pass along the
  184. * options specified here to all instances of the command being executed.
  185. */
  186. /**
  187. * By default, Drush will prepend the name of the site to the output of any
  188. * multiple-site command execution. To disable this behavior, set the
  189. * "--no-label" option.
  190. */
  191. # $options['no-label'] = TRUE;
  192. /**
  193. * An explicit list of tables which should be included in sql-dump and sql-sync.
  194. */
  195. # $options['tables']['common'] = array('user', 'permissions', 'role_permission', 'role');
  196. /**
  197. * List of tables whose *data* is skipped by the 'sql-dump' and 'sql-sync'
  198. * commands when the "--structure-tables-key=common" option is provided.
  199. * You may add specific tables to the existing array or add a new element.
  200. */
  201. # $options['structure-tables']['common'] = array('cache', 'cache_*', 'history', 'search_*', 'sessions', 'watchdog');
  202. /**
  203. * List of tables to be omitted entirely from SQL dumps made by the 'sql-dump'
  204. * and 'sql-sync' commands when the "--skip-tables-key=common" option is
  205. * provided on the command line. This is useful if your database contains
  206. * non-Drupal tables used by some other application or during a migration for
  207. * example. You may add new tables to the existing array or add a new element.
  208. */
  209. # $options['skip-tables']['common'] = array('migration_*');
  210. /**
  211. * Override specific entries in Drupal's variable system or settings.php (D6/D7 only).
  212. */
  213. # $options['variables']['site_name'] = 'My Drupal site';
  214. # $options['variables']['theme_default'] = 'minnelli';
  215. # $options['variables']['anonymous'] = 'Visitor';
  216. /**
  217. * Command-specific execution options:
  218. *
  219. * Most execution options can be shared between multiple Drush commands; these
  220. * are specified as top-level elements of the $options array in the prior
  221. * examples above. On the other hand, other options are command-specific, and,
  222. * in some cases, a shared option needs a different configuration depending on
  223. * which command is being executing.
  224. *
  225. * To define options that are only applicable to certain commands, make an entry
  226. * in the $command-specific array as shown below. The name of the command may
  227. * be either the command's full name or any of the command's aliases.
  228. *
  229. * Options defined here will be overridden by options of the same name on the
  230. * command line. Unary flags such as "--verbose" are overridden via special
  231. * "--no-xxx" options (e.g. "--no-verbose").
  232. *
  233. * Limitation: If 'verbose' is set in a command-specific option, it must be
  234. * cleared by '--no-verbose', not '--no-v', and visa-versa.
  235. */
  236. // Ensure all rsync commands use verbose output.
  237. # $command_specific['rsync'] = array('verbose' => TRUE);
  238. // Prevent drush ssh command from adding a cd to Drupal root before provided command.
  239. # $command_specific['ssh'] = array('cd' => FALSE);
  240. // Additional folders to search for scripts.
  241. // Separate by : (Unix-based systems) or ; (Windows).
  242. # $command_specific['script']['script-path'] = 'sites/all/scripts:profiles/myprofile/scripts';
  243. // Always show release notes when running pm-update or pm-updatecode.
  244. # $command_specific['pm-update'] = array('notes' => TRUE);
  245. # $command_specific['pm-updatecode'] = array('notes' => TRUE);
  246. // Set a predetermined username and password when using site-install.
  247. # $command_specific['site-install'] = array('account-name' => 'alice', 'account-pass' => 'secret');