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. If 'alias-path' is not set, then in one of the default
  42. * locations:
  43. * a. /etc/drush
  44. * b. In the drush installation folder
  45. * c. Inside the 'aliases' folder in the drush installation folder
  46. * d. $HOME/.drush
  47. * 3. Inside the sites folder of any bootstrapped Drupal site,
  48. * or any local Drupal site indicated by an alias used as
  49. * a parameter to a command
  50. *
  51. * Folders and files containing other versions of drush in their names will
  52. * be *skipped* (e.g. mysite.aliases.drush4rc.php or drush4/mysite.aliases.drushrc.php).
  53. * Names containing the current version of drush (e.g. mysite.aliases.drush5rc.php)
  54. * will be loaded.
  55. *
  56. * Files stored in these locations can be used to create aliases
  57. * to local and remote Drupal installations. These aliases can be
  58. * used in place of a site specification on the command line, and
  59. * may also be used in arguments to certain commands such as
  60. * "drush rsync" and "drush sql-sync".
  61. *
  62. * Alias files that are named after the single alias they contain
  63. * may use the syntax for the canoncial alias shown at the top of
  64. * this file, or they may set values in $options, just
  65. * like a drushrc.php configuration file:
  66. *
  67. * $options['uri'] = 'dev.mydrupalsite.com',
  68. * $options['root'] = '/path/to/drupal';
  69. *
  70. * When alias files use this form, then the name of the alias
  71. * is taken from the first part of the alias filename.
  72. *
  73. * Alias groups (aliases stored together in files called
  74. * GROUPNAME.aliases.drushrc.php, as mentioned above) also
  75. * create an implicit namespace that is named after the group
  76. * name.
  77. *
  78. * For example:
  79. *
  80. * # File: mysite.aliases.drushrc.php
  81. * $aliases['dev'] = array(
  82. * 'root' => '/path/to/drupal',
  83. * 'uri' => 'dev.mydrupalsite.com',
  84. * );
  85. * $aliases['live'] = array(
  86. * 'root' => '/other/path/to/drupal',
  87. * 'uri' => 'mydrupalsite.com',
  88. * );
  89. *
  90. * Then the following special aliases are defined:
  91. *
  92. * @mysite An alias named after the groupname
  93. * may be used to reference all of the
  94. * aliases in the group (e.g. drush @mydrupalsite status)
  95. *
  96. * @mysite.dev A copy of @dev
  97. *
  98. * @mysite.live A copy of @live
  99. *
  100. * Thus, aliases defined in an alias group file may be referred to
  101. * either by their simple (short) name, or by thier full namespace-qualified
  102. * name.
  103. *
  104. * To see an example alias definition for the current bootstrapped
  105. * site, use the "site-alias" command with the built-in alias "@self":
  106. *
  107. * $ drush site-alias @self
  108. *
  109. * If you would like to see all of the Drupal sites at a specified
  110. * root directory, use the built-in alias "@sites":
  111. *
  112. * $ drush -r /path/to/drupal site-alias @sites
  113. *
  114. * The built-in alias "@none" represents the state of no Drupal site;
  115. * to ignore the site at the cwd and just see default drush status:
  116. *
  117. * $ drush @none status
  118. *
  119. * See `drush help site-alias` for more options for displaying site
  120. * aliases. See `drush topic docs-bastion` for instructions on configuring
  121. * remote access to a Drupal site behind a firewall via a bastion server.
  122. *
  123. * Although most aliases will contain only a few options, a number
  124. * of settings that are commonly used appear below:
  125. *
  126. * - 'uri': In Drupal 7, the value of --uri should always be the same as
  127. * when the site is being accessed from a web browser (e.g. http://mysite.org,
  128. * although the http:// is optional). In Drupal 6, the value of --uri should
  129. * always be the same as the site's folder name in the 'sites' folder
  130. * (e.g. default); it is best if the site folder name matches the
  131. * URI from the browser, and is consistent on every instance of the
  132. * same site (e.g. also use sites/mysite.org for http://dev.mysite.org).
  133. * - 'root': The Drupal root; must not be specified as a relative path.
  134. * - 'remote-port': If the database is remote and 'db-url' contains
  135. * a tunneled port number, put the actual database port number
  136. * used on the remote machine in the 'remote-port' setting.
  137. * - 'remote-host': The fully-qualified domain name of the remote system
  138. * hosting the Drupal instance. The remote-host option must be
  139. * omitted for local sites, as this option controls whether or not
  140. * rsync parameters are for local or remote machines.
  141. * - 'remote-user': The username to log in as when using ssh or rsync.
  142. * - 'ssh-options': If the target requires special options, such as a non-
  143. * standard port, alternative identity file, or alternative
  144. * authentication method, ssh- options can contain a string of extra
  145. * options that are used with the ssh command, eg "-p 100"
  146. * - 'parent': The name of a parent alias (e.g. '@server') to use as a basis
  147. * for this alias. Any value of the parent will appear in the child
  148. * unless overridden by an item with the same name in the child.
  149. * Multiple inheritance is possible; name multiple parents in the
  150. * 'parent' item separated by commas (e.g. '@server,@devsite').
  151. * - 'db-url': The Drupal 6 database connection string from settings.php.
  152. * For remote databases accessed via an ssh tunnel, set the port
  153. * number to the tunneled port as it is accessed on the local machine.
  154. * If 'db-url' is not provided, then drush will automatically look it
  155. * up, either from settings.php on the local machine, or via backend invoke
  156. * if the target alias specifies a remote server.
  157. * - 'databases': Like 'db-url', but contains the full Drupal 7 databases
  158. * record. Drush will look up the 'databases' record if it is not specified.
  159. * - 'path-aliases': An array of aliases for common rsync targets.
  160. * Relative aliases are always taken from the Drupal root.
  161. * '%drush-script': The path to the 'drush' script, or to 'drush.php' or
  162. * 'drush.bat', as desired. This is used by backend invoke when drush
  163. * runs a drush command. The default is 'drush' on remote machines, or
  164. * the full path to drush.php on the local machine.
  165. * '%drush': A read-only property: points to the folder that the drush script
  166. * is stored in.
  167. * '%dump-dir': Path to directory that "drush sql-sync" should use to store
  168. * sql-dump files. Helpful filenames are auto-generated.
  169. * '%dump': Path to the file that "drush sql-sync" should use to store sql-dump file.
  170. * '%files': Path to 'files' directory. This will be looked up if not specified.
  171. * '%root': A reference to the Drupal root defined in the 'root' item
  172. * in the site alias record.
  173. * - 'command-specific': These options will only be set if the alias
  174. * is used with the specified command. In the example below, the option
  175. * `--no-cache` will be selected whenever the @stage alias
  176. * is used in any of the following ways:
  177. * drush @stage sql-sync @self @live
  178. * drush sql-sync @stage @live
  179. * drush sql-sync @live @stage
  180. * In case of conflicting options, command-specific options in targets
  181. * (source and destination) take precedence over command-specific options
  182. * in the bootstrapped site, and command-specific options in a destination
  183. * alias will take precedence over those in a source alias.
  184. * - 'source-command-specific' and 'target-command-specific': Behaves exactly
  185. * like the 'command-specific' option, but is applied only if the alias
  186. * is used as the source or target, respectively, of an rsync or sql-sync
  187. * command. In the example below, `--skip-tables-list=comments` whenever
  188. * the alias @live is the target of an sql-sync command, but comments will
  189. * be included if @live is the source for the sql-sync command.
  190. * Some examples appear below. Remove the leading hash signs to enable.
  191. */
  192. #$aliases['stage'] = array(
  193. # 'uri' => 'stage.mydrupalsite.com',
  194. # 'root' => '/path/to/remote/drupal/root',
  195. # 'db-url' => 'pgsql://username:password@dbhost.com:port/databasename',
  196. # 'remote-host' => 'mystagingserver.myisp.com',
  197. # 'remote-user' => 'publisher',
  198. # 'path-aliases' => array(
  199. # '%drush' => '/path/to/drush',
  200. # '%drush-script' => '/path/to/drush/drush',
  201. # '%dump-dir' => '/path/to/dumps/',
  202. # '%files' => 'sites/mydrupalsite.com/files',
  203. # '%custom' => '/my/custom/path',
  204. # ),
  205. # 'command-specific' => array (
  206. # 'sql-sync' => array (
  207. # 'no-cache' => TRUE,
  208. # ),
  209. # ),
  210. # );
  211. #$aliases['dev'] = array(
  212. # 'uri' => 'dev.mydrupalsite.com',
  213. # 'root' => '/path/to/drupal/root',
  214. # );
  215. #$aliases['server'] = array(
  216. # 'remote-host' => 'mystagingserver.myisp.com',
  217. # 'remote-user' => 'publisher',
  218. # );
  219. #$aliases['live'] = array(
  220. # 'parent' => '@server,@dev',
  221. # 'uri' => 'mydrupalsite.com',
  222. # 'target-command-specific' => array (
  223. # 'sql-sync' => array (
  224. # 'skip-tables-list' => 'comments',
  225. # ),
  226. # ),
  227. # );