From 7e4902c2b2b6426b325041f53a9af1274b48a367 Mon Sep 17 00:00:00 2001 From: BinotaLIU Date: Tue, 30 Nov 2021 08:32:57 +0800 Subject: [PATCH] Use `valet use` to switch version (#77) --- phpswitch.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/phpswitch.sh b/phpswitch.sh index f660cf7..479c8d4 100755 --- a/phpswitch.sh +++ b/phpswitch.sh @@ -106,12 +106,6 @@ if [[ " ${php_array[*]} " == *"$php_version"* ]]; then # Check that the requested version is installed if [[ " ${php_installed_array[*]} " == *"$php_version"* ]]; then - # Stop valet service - if [[ ($valet_installed -eq 1) && ($valet_restart -eq 1) ]]; then - echo "Stop Valet service" - valet stop - fi - # Switch Shell echo "Switching to $php_version" echo "Switching your shell" @@ -159,9 +153,9 @@ $comment_apache_module_string\\ # Switch valet if [[ $valet_restart -eq 1 ]]; then - if [[ valet_installed -eq 1 ]]; then - valet restart - else + if [[ $valet_installed -eq 1 ]]; then + valet use $php_version --force + else echo "valet doesn't installed in your system, will skip restarting valet service" fi fi