class SiteAliasFileDiscovery (View source)

Discover alias files named:

  • sitename.site.yml: contains multiple aliases, one for each of the environments of 'sitename'.

Drush aliases that contain both a site name and an environment (e.g. @site.env) will cause Drush to find the file named after the respective site name and retrieve the specified environment record.

Sites may also define a special alias file self.site.yml, which may be stored in the drush/sites directory relative to either the Drupal root or the Composer root of the site. The environments in this file will be merged with the available environments for the element @self, however it is defined.

Properties

protected $searchLocations
protected $locationFilter
protected $depth

Methods

__construct($searchLocations = [], $depth = '<= 1', $locationFilter = null)

No description

$this
addSearchLocation($paths)

Add a location that alias files may be found.

string[]
searchLocations()

Return all of the paths where alias files may be found.

locationFilter()

No description

$this
depth(string|int $depth)

Set the search depth for finding alias files

filterByLocation($location)

Only search for aliases that are in alias files stored in directories whose basename or key matches the specified location.

string[]
find(string $siteName)

Find an alias file SITENAME.site.yml in one of the specified search locations.

string|bool
findSingleSiteAliasFile(string $siteName)

Find an alias file SITENAME.site.yml in one of the specified search locations.

string[]
findAllSingleAliasFiles()

Return a list of all SITENAME.site.yml files in any of the search locations.

string[]
findAllLegacyAliasFiles()

Return all of the legacy alias files used in previous Drush versions.

Finder
createFinder(string $searchPattern)

Create a Symfony Finder object to search all available search locations for the specified search pattern.

string[]
searchForAliasFiles(string $searchPattern)

Return a list of all alias files matching the provided pattern.

splitLocationFromSite($site)

splitLocationFromSite returns the part of 'site' before the first '.' as the "path match" component, and the part after the first '.' as the "site" component.

extractKey($basename, $filenameExensions)

No description

Details

__construct($searchLocations = [], $depth = '<= 1', $locationFilter = null)

No description

Parameters

$searchLocations
$depth
$locationFilter

$this addSearchLocation($paths)

Add a location that alias files may be found.

Parameters

$paths

Return Value

$this

string[] searchLocations()

Return all of the paths where alias files may be found.

Return Value

string[]

locationFilter()

No description

$this depth(string|int $depth)

Set the search depth for finding alias files

Parameters

string|int $depth (\Symfony\Component\Finder\Finder::depth)

Return Value

$this

filterByLocation($location)

Only search for aliases that are in alias files stored in directories whose basename or key matches the specified location.

Parameters

$location

string[] find(string $siteName)

Find an alias file SITENAME.site.yml in one of the specified search locations.

Parameters

string $siteName

Return Value

string[]

string|bool findSingleSiteAliasFile(string $siteName)

Find an alias file SITENAME.site.yml in one of the specified search locations.

Parameters

string $siteName

Return Value

string|bool

string[] findAllSingleAliasFiles()

Return a list of all SITENAME.site.yml files in any of the search locations.

Return Value

string[]

string[] findAllLegacyAliasFiles()

Return all of the legacy alias files used in previous Drush versions.

Return Value

string[]

protected Finder createFinder(string $searchPattern)

Create a Symfony Finder object to search all available search locations for the specified search pattern.

Parameters

string $searchPattern

Return Value

Finder

protected string[] searchForAliasFiles(string $searchPattern)

Return a list of all alias files matching the provided pattern.

Parameters

string $searchPattern

Return Value

string[]

protected splitLocationFromSite($site)

splitLocationFromSite returns the part of 'site' before the first '.' as the "path match" component, and the part after the first '.' as the "site" component.

Parameters

$site

protected extractKey($basename, $filenameExensions)

No description

Parameters

$basename
$filenameExensions