SiteAliasFileDiscovery
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
No description
Add a location that alias files may be found.
Return all of the paths where alias files may be found.
No description
Set the search depth for finding alias files
Only search for aliases that are in alias files stored in directories whose basename or key matches the specified location.
Find an alias file SITENAME.site.yml in one of the specified search locations.
Find an alias file SITENAME.site.yml in one of the specified search locations.
Return a list of all SITENAME.site.yml files in any of the search locations.
Return all of the legacy alias files used in previous Drush versions.
Create a Symfony Finder object to search all available search locations for the specified search pattern.
Return a list of all alias files matching the provided pattern.
splitLocationFromSite returns the part of 'site' before the first '.' as the "path match" component, and the part after the first '.' as the "site" component.
No description
Details
__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.
protected Finder
createFinder(string $searchPattern)
Create a Symfony Finder object to search all available search locations for the specified search pattern.
protected string[]
searchForAliasFiles(string $searchPattern)
Return a list of all alias files matching the provided pattern.
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.
protected
extractKey($basename, $filenameExensions)
No description