mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Drop need to pass sock to isolate command
This commit is contained in:
@@ -88,7 +88,7 @@ public function createConfigurationFiles($phpVersion = null)
|
||||
$contents = $this->files->get(__DIR__.'/../stubs/etc-phpfpm-valet.conf');
|
||||
$contents = str_replace(['VALET_USER', 'VALET_HOME_PATH'], [user(), VALET_HOME_PATH], $contents);
|
||||
if ($phpVersion) {
|
||||
$contents = str_replace('valet.sock', $this->fpmSockName($phpVersion), $contents);
|
||||
$contents = str_replace('valet.sock', self::fpmSockName($phpVersion), $contents);
|
||||
}
|
||||
$this->files->put($fpmConfigFile, $contents);
|
||||
|
||||
@@ -195,12 +195,14 @@ public function isolateDirectoryToVersion($directory, $version)
|
||||
throw new DomainException("The [{$directory}] site could not be found in Valet's site list.");
|
||||
}
|
||||
|
||||
$version = $this->validateRequestedVersion($version);
|
||||
|
||||
$this->brew->ensureInstalled($version, [], $this->taps);
|
||||
|
||||
$oldCustomPhpVersion = $this->site->customPhpVersion($site); // Example output: "74"
|
||||
$this->createConfigurationFiles($version);
|
||||
|
||||
$this->site->isolate($site, $this->fpmSockName($version), $version);
|
||||
$this->site->isolate($site, $version);
|
||||
|
||||
$this->stopIfUnused($oldCustomPhpVersion);
|
||||
$this->restart($version);
|
||||
@@ -342,7 +344,7 @@ public function validateRequestedVersion($version)
|
||||
* @param string|null $phpVersion
|
||||
* @return string
|
||||
*/
|
||||
public function fpmSockName($phpVersion = null)
|
||||
public static function fpmSockName($phpVersion = null)
|
||||
{
|
||||
$versionInteger = preg_replace('~[^\d]~', '', $phpVersion);
|
||||
|
||||
@@ -373,12 +375,12 @@ public function updateConfigurationForGlobalUpdate($newPhpVersion, $oldPhpVersio
|
||||
return;
|
||||
}
|
||||
|
||||
if (strpos($content, $this->fpmSockName($newPhpVersion)) !== false) {
|
||||
if (strpos($content, self::fpmSockName($newPhpVersion)) !== false) {
|
||||
info(sprintf('Updating site %s to keep using version: %s', $file, $newPhpVersion));
|
||||
$this->files->put(VALET_HOME_PATH.'/Nginx/'.$file, str_replace($this->fpmSockName($newPhpVersion), 'valet.sock', $content));
|
||||
$this->files->put(VALET_HOME_PATH.'/Nginx/'.$file, str_replace(self::fpmSockName($newPhpVersion), 'valet.sock', $content));
|
||||
} elseif (strpos($content, 'valet.sock') !== false) {
|
||||
info(sprintf('Updating site %s to keep using version: %s', $file, $oldPhpVersion));
|
||||
$this->files->put(VALET_HOME_PATH.'/Nginx/'.$file, str_replace('valet.sock', $this->fpmSockName($oldPhpVersion), $content));
|
||||
$this->files->put(VALET_HOME_PATH.'/Nginx/'.$file, str_replace('valet.sock', self::fpmSockName($oldPhpVersion), $content));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -392,7 +394,7 @@ public function updateConfigurationForGlobalUpdate($newPhpVersion, $oldPhpVersio
|
||||
public function utilizedPhpVersions()
|
||||
{
|
||||
$fpmSockFiles = $this->brew->supportedPhpVersions()->map(function ($version) {
|
||||
return $this->fpmSockName($this->normalizePhpVersion($version));
|
||||
return self::fpmSockName($this->normalizePhpVersion($version));
|
||||
})->unique();
|
||||
|
||||
return collect($this->files->scandir(VALET_HOME_PATH.'/Nginx'))
|
||||
|
||||
Reference in New Issue
Block a user