function ExecutableFinder::find
File
-
core/
modules/ package_manager/ src/ ExecutableFinder.php, line 52
Class
- ExecutableFinder
- An executable finder which looks for executable paths in configuration.
Namespace
Drupal\package_managerCode
public function find(string $name) : string {
$legacy_executables = $this->configFactory
->get('package_manager.settings')
->get('executables');
if ($name === 'rsync') {
try {
return Settings::get('package_manager_rsync_path', $this->decorated
->find($name));
} catch (LogicException $e) {
if (isset($legacy_executables[$name])) {
@trigger_error("Storing the path to rsync in configuration is deprecated in drupal:11.2.4 and not supported in drupal:12.0.0. Move it to the <code>package_manager_rsync_path</code> setting instead. See https://www.drupal.org/node/3540264", E_USER_DEPRECATED);
return $legacy_executables[$name];
}
throw $e;
}
}
elseif ($name === 'composer') {
$path = $this->getLocalComposerPath();
if ($path && file_exists($path)) {
return $path;
}
// If the regular executable finder can't find Composer, and it's not
// overridden by a setting, fall back to the configured path to Composer
// (if available), which is no longer supported.
try {
return Settings::get('package_manager_composer_path', $this->decorated
->find($name));
} catch (LogicException $e) {
if (isset($legacy_executables[$name])) {
@trigger_error("Storing the path to Composer in configuration is deprecated in drupal:11.2.4 and not supported in drupal:12.0.0. Add composer/composer directly to your project's dependencies instead. See https://www.drupal.org/node/3540264", E_USER_DEPRECATED);
return $legacy_executables[$name];
}
throw $e;
}
}
return $this->decorated
->find($name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.