function _drush_sitealias_add_transient_defaults

8.0.x sitealias.inc _drush_sitealias_add_transient_defaults(&$alias_record)
6.x sitealias.inc _drush_sitealias_add_transient_defaults(&$alias_record)
7.x sitealias.inc _drush_sitealias_add_transient_defaults(&$alias_record)
3.x sitealias.inc _drush_sitealias_add_transient_defaults(&$alias_record)
4.x sitealias.inc _drush_sitealias_add_transient_defaults(&$alias_record)
5.x sitealias.inc _drush_sitealias_add_transient_defaults(&$alias_record)
master sitealias.inc _drush_sitealias_add_transient_defaults(&$alias_record)

Add "transient" default values to the given alias record. The difference between a static default and a transient default is that static defaults -always- exist in the alias record, whereas transient defaults are only added if the given drush command explicitly calls this function. The other advantage of transient defaults is that it is possible to differentiate between a default value and an unspecified value, since the transient defaults are not added until requested.

Since transient defaults are not cached, you should avoid doing expensive operations here. To be safe, drush commands should avoid calling this function more than once.

Parameters

alias_record: An alias record with most values already filled in

2 calls to _drush_sitealias_add_transient_defaults()
drush_sitealias_evaluate_path in includes/sitealias.inc
Evaluate a path from its shorthand form to a literal path usable by rsync.
_drush_sitealias_prepare_record in commands/core/sitealias.drush.inc
Given a site alias name, print out a php-syntax representation of it.

File

includes/sitealias.inc, line 1481
The site alias API.

Code

function _drush_sitealias_add_transient_defaults(&$alias_record) {
  if (isset($alias_record['path-aliases'])) {
    // Add the path to the drush folder to the path aliases as !drush
    if (!array_key_exists('%drush', $alias_record['path-aliases'])) {
      if (array_key_exists('%drush-script', $alias_record['path-aliases'])) {
        $alias_record['path-aliases']['%drush'] = dirname($alias_record['path-aliases']['%drush-script']);
      }
      else {
        $alias_record['path-aliases']['%drush'] = dirname(drush_find_drush());
      }
    }
    // Add the path to the site folder to the path aliases as !site
    if (!array_key_exists('%site', $alias_record['path-aliases']) && array_key_exists('uri', $alias_record)) {
      $alias_record['path-aliases']['%site'] = 'sites/' . drush_sitealias_uri_to_site_dir($alias_record['uri'], drush_sitealias_get_root($alias_record)) . '/';
    }
  }
}