mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 16:10:08 +01:00
wip
This commit is contained in:
@@ -304,12 +304,14 @@ function ($version) use ($resolvedPhpVersion) {
|
||||
*
|
||||
* @param string $phpVersion
|
||||
*
|
||||
* @return string|bool
|
||||
* @return string
|
||||
*/
|
||||
public function getPhpBinaryPath($phpVersion)
|
||||
{
|
||||
if (file_exists(BREW_PREFIX . "/opt/$phpVersion/bin/php")) {
|
||||
return BREW_PREFIX . "/opt/$phpVersion/bin/php";
|
||||
$versionInteger = preg_replace('~[^\d]~', '', $phpVersion);
|
||||
|
||||
if (file_exists(BREW_PREFIX . "/bin/valetphp{$versionInteger}")) {
|
||||
return BREW_PREFIX . "/bin/valetphp{$versionInteger}";
|
||||
}
|
||||
|
||||
$cellar = $this->cli->runAsUser("brew --cellar $phpVersion");
|
||||
@@ -321,9 +323,27 @@ public function getPhpBinaryPath($phpVersion)
|
||||
return trim($cellar).'/'.$path.'/bin/php';
|
||||
}
|
||||
|
||||
if (file_exists(BREW_PREFIX . "/opt/$phpVersion/bin/php")) {
|
||||
return BREW_PREFIX . "/opt/$phpVersion/bin/php";
|
||||
}
|
||||
|
||||
return "php";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a PHP binary symlink for a PHP version
|
||||
*
|
||||
* @param string $phpVersion
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function symlinkPhpBinary($phpVersion)
|
||||
{
|
||||
$versionInteger = preg_replace('~[^\d]~', '', $phpVersion);
|
||||
|
||||
$this->files->symlinkAsUser($this->getPhpBinaryPath($phpVersion), BREW_PREFIX . "/bin/valetphp{$versionInteger}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart the linked PHP-FPM Homebrew service.
|
||||
*
|
||||
|
||||
@@ -221,6 +221,7 @@ public function isolateDirectory($directory, $version)
|
||||
$this->createConfigurationFiles($version);
|
||||
|
||||
$this->site->isolate($site, $version);
|
||||
$this->brew->symlinkPhpBinary($version);
|
||||
|
||||
$this->stopIfUnused($oldCustomPhpVersion);
|
||||
$this->restart($version);
|
||||
|
||||
Reference in New Issue
Block a user