example.aliases.drushrc.php

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

File

examples/example.aliases.drushrc.php
View source
  1. <?php
  2. /**
  3. * Example of valid statements for an alias file. Use this
  4. * file as a guide to creating your own aliases.
  5. *
  6. * Aliases are commonly used to define short names for
  7. * local or remote Drupal installations; however, an alias
  8. * is really nothing more than a collection of options.
  9. * A canonical alias named "dev" that points to a local
  10. * Drupal site named "dev.mydrupalsite.com" looks like this:
  11. *
  12. * $aliases['dev'] = array(
  13. * 'root' => '/path/to/drupal',
  14. * 'uri' => 'dev.mydrupalsite.com',
  15. * );
  16. *
  17. * With this alias definition, then the following commands
  18. * are equivalent:
  19. *
  20. * $ drush @dev status
  21. * $ drush --root=/path/to/drupal --uri=dev.mydrupalsite.com status
  22. *
  23. * See the --uri option documentation below for hints on setting its value.
  24. *
  25. * Any option that can be placed on the drush commandline
  26. * can also appear in an alias definition.
  27. *
  28. * There are several ways to create alias files.
  29. *
  30. * + Put each alias in a separate file called ALIASNAME.alias.drushrc.php
  31. * + Put multiple aliases in a single file called aliases.drushrc.php
  32. * + Put groups of aliases into files called GROUPNAME.aliases.drushrc.php
  33. *
  34. * Drush will search for aliases in any of these files using
  35. * the alias search path. The following locations are examined
  36. * for alias files:
  37. *
  38. * 1. In any path set in $options['alias-path'] in drushrc.php,
  39. * or (equivalently) any path passed in via --alias-path=...
  40. * on the command line.
  41. * 2. In one of the default locations:
  42. * a. /etc/drush
  43. * b. $HOME/.drush
  44. * c. The sites/all/drush folder for the current Drupal site
  45. * 3. Inside the sites folder of any bootstrapped Drupal site,
  46. * or any local Drupal site indicated by an alias used as
  47. * a parameter to a command
  48. *
  49. * Folders and files containing other versions of drush in their names will
  50. * be *skipped* (e.g. mysite.aliases.drush4rc.php or drush4/mysite.aliases.drushrc.php).
  51. * Names containing the current version of drush (e.g. mysite.aliases.drush5rc.php)
  52. * will be loaded.
  53. *
  54. * Files stored in these locations can be used to create aliases
  55. * to local and remote Drupal installations. These aliases can be
  56. * used in place of a site specification on the command line, and
  57. * may also be used in arguments to certain commands such as
  58. * "drush rsync" and "drush sql-sync".
  59. *
  60. * Alias files that are named after the single alias they contain
  61. * may use the syntax for the canonical alias shown at the top of
  62. * this file, or they may set values in $options, just
  63. * like a drushrc.php configuration file:
  64. *
  65. * $options['uri'] = 'dev.mydrupalsite.com',
  66. * $options['root'] = '/path/to/drupal';
  67. *
  68. * When alias files use this form, then the name of the alias
  69. * is taken from the first part of the alias filename.
  70. *
  71. * Alias groups (aliases stored together in files called
  72. * GROUPNAME.aliases.drushrc.php, as mentioned above) also
  73. * create an implicit namespace that is named after the group
  74. * name.
  75. *
  76. * For example:
  77. *
  78. * # File: mysite.aliases.drushrc.php
  79. * $aliases['dev'] = array(
  80. * 'root' => '/path/to/drupal',
  81. * 'uri' => 'dev.mydrupalsite.com',
  82. * );
  83. * $aliases['live'] = array(
  84. * 'root' => '/other/path/to/drupal',
  85. * 'uri' => 'mydrupalsite.com',
  86. * );
  87. *
  88. * Then the following special aliases are defined:
  89. *
  90. * @mysite An alias named after the groupname
  91. * may be used to reference all of the
  92. * aliases in the group (e.g. drush @mydrupalsite status)
  93. *
  94. * @mysite.dev A copy of @dev
  95. *
  96. * @mysite.live A copy of @live
  97. *
  98. * Thus, aliases defined in an alias group file may be referred to
  99. * either by their simple (short) name, or by their full namespace-qualified
  100. * name.
  101. *
  102. * To see an example alias definition for the current bootstrapped
  103. * site, use the "site-alias" command with the built-in alias "@self":
  104. *
  105. * $ drush site-alias @self
  106. *
  107. * TIP: If you would like to have drush include a 'databases' record
  108. * in the output, include the options --with-db and --show-passwords:
  109. *
  110. * $ drush site-alias @self --with-db --show-passwords
  111. *
  112. * If you would like to see all of the Drupal sites at a specified
  113. * root directory, use the built-in alias "@sites":
  114. *
  115. * $ drush -r /path/to/drupal site-alias @sites
  116. *
  117. * It is also possible to define explicit lists of sites using a special
  118. * alias list definition. Alias lists contain a list of alias names in
  119. * the group, and no other information. For example:
  120. *
  121. * $aliases['mydevsites'] = array(
  122. * 'site-list' => array('@mysite.dev', '@otherside.dev');
  123. * );
  124. *
  125. * The built-in alias "@none" represents the state of no Drupal site;
  126. * to ignore the site at the cwd and just see default drush status:
  127. *
  128. * $ drush @none status
  129. *
  130. * See `drush help site-alias` for more options for displaying site
  131. * aliases. See `drush topic docs-bastion` for instructions on configuring
  132. * remote access to a Drupal site behind a firewall via a bastion server.
  133. *
  134. * Although most aliases will contain only a few options, a number
  135. * of settings that are commonly used appear below:
  136. *
  137. * - 'uri': In Drupal 7, the value of --uri should always be the same as
  138. * when the site is being accessed from a web browser (e.g. http://mysite.org,
  139. * although the http:// is optional). In Drupal 6, the value of --uri should
  140. * always be the same as the site's folder name in the 'sites' folder
  141. * (e.g. default); it is best if the site folder name matches the
  142. * URI from the browser, and is consistent on every instance of the
  143. * same site (e.g. also use sites/mysite.org for http://dev.mysite.org).
  144. * - 'root': The Drupal root; must not be specified as a relative path.
  145. * - 'remote-port': If the database is remote and 'db-url' contains
  146. * a tunneled port number, put the actual database port number
  147. * used on the remote machine in the 'remote-port' setting.
  148. * - 'remote-host': The fully-qualified domain name of the remote system
  149. * hosting the Drupal instance. **Important Note: The remote-host option
  150. * must be omitted for local sites, as this option controls whether or not
  151. * rsync parameters are for local or remote machines.
  152. * - 'remote-user': The username to log in as when using ssh or rsync.
  153. * - 'os': The operating system of the remote server. Valid values
  154. * are 'Windows' and 'Linux'. Be sure to set this value for all remote
  155. * aliases because the default value is PHP_OS if 'remote-host'
  156. * is not set, and 'Linux' (or $options['remote-os']) if it is. Therefore,
  157. * if you set a 'remote-host' value, and your remote OS is Windows, if you
  158. * do not set the 'OS' value, it will default to 'Linux' and could cause
  159. * unintended consequences, particularly when running 'drush sql-sync'.
  160. * - 'ssh-options': If the target requires special options, such as a non-
  161. * standard port, alternative identity file, or alternative
  162. * authentication method, ssh-options can contain a string of extra
  163. * options that are used with the ssh command, eg "-p 100"
  164. * - 'parent': The name of a parent alias (e.g. '@server') to use as a basis
  165. * for this alias. Any value of the parent will appear in the child
  166. * unless overridden by an item with the same name in the child.
  167. * Multiple inheritance is possible; name multiple parents in the
  168. * 'parent' item separated by commas (e.g. '@server,@devsite').
  169. * - 'db-url': The Drupal 6 database connection string from settings.php.
  170. * For remote databases accessed via an ssh tunnel, set the port
  171. * number to the tunneled port as it is accessed on the local machine.
  172. * If 'db-url' is not provided, then drush will automatically look it
  173. * up, either from settings.php on the local machine, or via backend invoke
  174. * if the target alias specifies a remote server.
  175. * - 'databases': Like 'db-url', but contains the full Drupal 7 databases
  176. * record. Drush will look up the 'databases' record if it is not specified.
  177. * - 'path-aliases': An array of aliases for common rsync targets.
  178. * Relative aliases are always taken from the Drupal root.
  179. * '%drush-script': The path to the 'drush' script, or to 'drush.php' or
  180. * 'drush.bat', as desired. This is used by backend invoke when drush
  181. * runs a drush command. The default is 'drush' on remote machines, or
  182. * the full path to drush.php on the local machine.
  183. * '%drush': A read-only property: points to the folder that the drush script
  184. * is stored in.
  185. * '%dump-dir': Path to directory that "drush sql-sync" should use to store
  186. * sql-dump files. Helpful filenames are auto-generated.
  187. * '%dump': Path to the file that "drush sql-sync" should use to store sql-dump file.
  188. * '%files': Path to 'files' directory. This will be looked up if not specified.
  189. * '%root': A reference to the Drupal root defined in the 'root' item
  190. * in the site alias record.
  191. * - 'php': path to custom php interpreter, defaults to /usr/bin/php
  192. * - 'php-options': commandline options for php interpreter, you may
  193. * want to set this to '-d error_reporting="E_ALL^E_DEPRECATED"'
  194. * - 'variables' : An array of name/value pairs which override Drupal variables.
  195. * These values take precedence even over settings.php variable overrides.
  196. * - 'command-specific': These options will only be set if the alias
  197. * is used with the specified command. In the example below, the option
  198. * `--no-cache` will be selected whenever the @stage alias
  199. * is used in any of the following ways:
  200. * drush @stage sql-sync @self @live
  201. * drush sql-sync @stage @live
  202. * drush sql-sync @live @stage
  203. * In case of conflicting options, command-specific options in targets
  204. * (source and destination) take precedence over command-specific options
  205. * in the bootstrapped site, and command-specific options in a destination
  206. * alias will take precedence over those in a source alias.
  207. * - 'source-command-specific' and 'target-command-specific': Behaves exactly
  208. * like the 'command-specific' option, but is applied only if the alias
  209. * is used as the source or target, respectively, of an rsync or sql-sync
  210. * command. In the example below, `--skip-tables-list=comments` whenever
  211. * the alias @live is the target of an sql-sync command, but comments will
  212. * be included if @live is the source for the sql-sync command.
  213. * - '#peer': Settings that begin with a '#' are not used directly by Drush, and
  214. * in fact are removed before making a backend invoke call (for example). These
  215. * kinds of values are useful in conjunction with shell aliases. See
  216. * `drush topic docs-shell-aliases` for more information on this.
  217. * - rsync command options have specific requirements in order to
  218. * be passed through by Drush. See the comments on the sample below:
  219. *
  220. * 'command-specific' => array (
  221. * 'core-rsync' => array (
  222. *
  223. * // single-letter rsync options are placed in the 'mode' key
  224. * // instead of adding '--mode=rultvz' to drush rsync command.
  225. * 'mode' => 'rultvz',
  226. *
  227. * // multi-letter rsync options without values must be set to
  228. * // TRUE or NULL to work (i.e. setting $VALUE to 1, 0, or ''
  229. * // will not work).
  230. * 'delete' => TRUE,
  231. *
  232. * // wrapping an option's value in "" preserves inner '' on output;
  233. * // but is not always required.
  234. * 'exclude' => "'*.gz'",
  235. *
  236. * // cannot add multiple options of same key; each key overwrites
  237. * // the previous key's value. This 'exclude' option will overwrite
  238. * // the previous one above.
  239. * 'exclude' => '*.sql',
  240. *
  241. * // if you need multiple exludes, use an rsync exclude file
  242. * 'exclude-from' => "'/etc/rsync/exclude.rules'",
  243. *
  244. * // filter options with white space must be wrapped in "" to preserve
  245. * // the inner ''.
  246. * 'filter' => "'exclude *.sql'",
  247. *
  248. * // if you need multple filter options, see rsync merge-file options
  249. * 'filter' => "'merge /etc/rsync/default.rules'",
  250. * ),
  251. * ),
  252. *
  253. * Some examples appear below. Remove the leading hash signs to enable.
  254. */
  255. #$aliases['stage'] = array(
  256. # 'uri' => 'stage.mydrupalsite.com',
  257. # 'root' => '/path/to/remote/drupal/root',
  258. # 'db-url' => 'pgsql://username:password@dbhost.com:port/databasename',
  259. # 'remote-host' => 'mystagingserver.myisp.com',
  260. # 'remote-user' => 'publisher',
  261. # 'os' => 'Linux',
  262. # 'path-aliases' => array(
  263. # '%drush' => '/path/to/drush',
  264. # '%drush-script' => '/path/to/drush/drush',
  265. # '%dump-dir' => '/path/to/dumps/',
  266. # '%files' => 'sites/mydrupalsite.com/files',
  267. # '%custom' => '/my/custom/path',
  268. # ),
  269. # 'databases' =>
  270. # array (
  271. # 'default' =>
  272. # array (
  273. # 'default' =>
  274. # array (
  275. # 'driver' => 'mysql',
  276. # 'username' => 'sqlusername',
  277. # 'password' => 'sqlpassword',
  278. # 'port' => '',
  279. # 'host' => 'localhost',
  280. # 'database' => 'sqldbname',
  281. # ),
  282. # ),
  283. # ),
  284. # 'variables' => array(
  285. # 'site_name' => 'My Drupal site',
  286. # ),
  287. # 'command-specific' => array (
  288. # 'sql-sync' => array (
  289. # 'no-cache' => TRUE,
  290. # ),
  291. # ),
  292. # # This shell alias will run `mycommand` when executed via `drush @stage site-specific-alias`
  293. # 'shell-aliases' => array (
  294. # 'site-specific-alias' => '!mycommand',
  295. # ),
  296. # );
  297. #$aliases['dev'] = array(
  298. # 'uri' => 'dev.mydrupalsite.com',
  299. # 'root' => '/path/to/drupal/root',
  300. # 'variables' => array('mail_system' => array('default-system' => 'DevelMailLog')),
  301. # );
  302. #$aliases['server'] = array(
  303. # 'remote-host' => 'mystagingserver.myisp.com',
  304. # 'remote-user' => 'publisher',
  305. # 'os' => 'Linux',
  306. # );
  307. #$aliases['live'] = array(
  308. # 'parent' => '@server,@dev',
  309. # 'uri' => 'mydrupalsite.com',
  310. # 'target-command-specific' => array (
  311. # 'sql-sync' => array (
  312. # 'skip-tables-list' => 'comments',
  313. # ),
  314. # ),
  315. # );