1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 16:10:08 +01:00

Add Valet PHP isolation remover option & apply more suggestions from code review

This commit is contained in:
Nasir Uddin Nobin
2022-02-15 02:38:46 +06:00
committed by GitHub
parent acf190c57c
commit c247dc9709
3 changed files with 55 additions and 23 deletions

View File

@@ -123,11 +123,12 @@ public function updateConfiguration($phpVersion = null)
/**
* Restart the PHP FPM process.
*
* @param string|null $phpVersion
* @return void
*/
public function restart($phpVersion = null)
{
$this->brew->restartService($phpVersion ?: $this->getPhpVersionsToPerformRestart());
$this->brew->restartService($phpVersion ?: $this->utilizedPhpVersions());
}
/**
@@ -146,6 +147,7 @@ public function stop()
/**
* Get the path to the FPM configuration file for the current PHP version.
*
* @param string|null $phpVersion
* @return string
*/
public function fpmConfigPath($phpVersion = null)
@@ -298,7 +300,7 @@ public function fpmSockName($phpVersion = null)
/**
* Update all existing Nginx files when running a global PHP version update.
* If a given file is pointing to `valet.sock`, it's targeting the old global PHP version;
* If a given file is pointing to `valet.sock`, it's targeting the old global PHP version;
* update it to point to the new custom sock file for that version.
* If a given file is pointing the custom sock file for the new global version, that new
* version will now be hosted at `valet.sock`, so update the config file to point to that instead.
@@ -336,7 +338,7 @@ public function updateConfigurationForGlobalUpdate($newPhpVersion, $oldPhpVersio
*
* @return array
*/
public function getPhpVersionsToPerformRestart()
public function utilizedPhpVersions()
{
$fpmSockFiles = $this->brew->supportedPhpVersions()->map(function ($version) {
return $this->fpmSockName($this->normalizePhpVersion($version));
@@ -356,7 +358,7 @@ public function getPhpVersionsToPerformRestart()
// for example, "valet74.sock" will output "php74"
$phpVersion = 'php'.str_replace(['valet', '.sock'], '', $sock);
return $this->normalizePhpVersion($phpVersion); // example output php@7.4
return $this->normalizePhpVersion($phpVersion); // Example output php@7.4
}
}
})->merge([$this->brew->getLinkedPhpFormula()])->filter()->unique()->toArray();