diff --git a/cli/ValetPlus/Elasticsearch.php b/cli/ValetPlus/Elasticsearch.php index 2af5caf0..b5c142c2 100644 --- a/cli/ValetPlus/Elasticsearch.php +++ b/cli/ValetPlus/Elasticsearch.php @@ -122,6 +122,7 @@ public function getCurrentVersion(): ?string * * @param string $version * @param string $tld + * @return bool */ public function useVersion($version = self::ES_DEFAULT_VERSION, $tld = 'test') { @@ -139,7 +140,7 @@ public function useVersion($version = self::ES_DEFAULT_VERSION, $tld = 'test') if ($version === $currentVersion) { info('Already on this version'); - return; + return false; } if ($currentVersion) { // Stop current version. @@ -147,6 +148,7 @@ public function useVersion($version = self::ES_DEFAULT_VERSION, $tld = 'test') } $this->install($version, $tld); + return true; } diff --git a/cli/valet.php b/cli/valet.php index ba35d1ad..6943f249 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -607,10 +607,11 @@ throw new RuntimeException(sprintf('Not enough arguments (missing: "mode"). Available modes: %s', implode(', ', $modes))); } + $restart = true; switch ($mode) { case 'install': case 'use': - Elasticsearch::useVersion($targetVersion, Configuration::read()['tld']); + $restart = Elasticsearch::useVersion($targetVersion, Configuration::read()['tld']); break; case 'on': @@ -629,8 +630,10 @@ break; } - PhpFpm::restart(); - Nginx::restart(); + if ($restart) { + PhpFpm::restart(); + Nginx::restart(); + } }) ->descriptions( 'Enable/disable/switch Elasticsearch. ' .