From b7880793a9b10b214a5901c8d62e91b77845b34a Mon Sep 17 00:00:00 2001 From: NasirNobin Date: Tue, 22 Mar 2022 01:52:51 +0600 Subject: [PATCH] wip --- cli/Valet/Brew.php | 26 +++++++++----------------- cli/Valet/PhpFpm.php | 1 - 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/cli/Valet/Brew.php b/cli/Valet/Brew.php index 1f27d72..5190674 100644 --- a/cli/Valet/Brew.php +++ b/cli/Valet/Brew.php @@ -309,6 +309,7 @@ function ($version) use ($resolvedPhpVersion) { public function getPhpBinaryPath($phpVersion) { $versionInteger = preg_replace('~[^\d]~', '', $phpVersion); + $binPath = null; if (file_exists(BREW_PREFIX . "/bin/valetphp{$versionInteger}")) { return BREW_PREFIX . "/bin/valetphp{$versionInteger}"; @@ -320,30 +321,21 @@ public function getPhpBinaryPath($phpVersion) $path = !empty($details[0]->linked_keg) ? $details[0]->linked_keg : $details[0]->installed[0]->version; if (file_exists(trim($cellar).'/'.$path.'/bin/php')) { - return trim($cellar).'/'.$path.'/bin/php'; + $binPath = trim($cellar).'/'.$path.'/bin/php'; } - if (file_exists(BREW_PREFIX . "/opt/$phpVersion/bin/php")) { - return BREW_PREFIX . "/opt/$phpVersion/bin/php"; + // if (!$binPath && file_exists(BREW_PREFIX . "/opt/$phpVersion/bin/php")) { + // return BREW_PREFIX . "/opt/$phpVersion/bin/php"; + // } + + if($binPath){ + $this->files->symlinkAsUser($binPath, BREW_PREFIX . "/bin/valetphp{$versionInteger}"); + return $binPath; } 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. * diff --git a/cli/Valet/PhpFpm.php b/cli/Valet/PhpFpm.php index 951c29f..990a373 100644 --- a/cli/Valet/PhpFpm.php +++ b/cli/Valet/PhpFpm.php @@ -221,7 +221,6 @@ public function isolateDirectory($directory, $version) $this->createConfigurationFiles($version); $this->site->isolate($site, $version); - $this->brew->symlinkPhpBinary($version); $this->stopIfUnused($oldCustomPhpVersion); $this->restart($version);