Added param 'priority_path' (For all plugins) for control paths priority when we search plugin binary. Issue #104.
This commit is contained in:
parent
e1c6709639
commit
59837a8ff1
27 changed files with 164 additions and 94 deletions
|
|
@ -31,6 +31,11 @@ abstract class Plugin
|
|||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $priorityPath = 'local';
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param Build $build
|
||||
|
|
@ -42,9 +47,28 @@ abstract class Plugin
|
|||
$this->build = $build;
|
||||
$this->options = $options;
|
||||
|
||||
if (!empty($options['priority_path']) && in_array($options['priority_path'], ['global', 'system'])) {
|
||||
$this->priorityPath = $options['priority_path'];
|
||||
}
|
||||
|
||||
$this->builder->logDebug('Plugin options: ' . json_encode($options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a binary required by a plugin.
|
||||
*
|
||||
* @param string $binary
|
||||
* @param bool $quiet Returns null instead of throwing an exception.
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @throws \Exception when no binary has been found and $quiet is false.
|
||||
*/
|
||||
public function findBinary($binary, $quiet = false)
|
||||
{
|
||||
return $this->builder->findBinary($binary, $quiet, $this->priorityPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Build
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue