From 7f32ab318e2cae7d4c055ab971bf0523b4f932c0 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sat, 30 Nov 2019 05:58:14 +0530 Subject: [PATCH] Show semantic versions on PHP install and correct logs --- package-lock.json | 28 +++++++++++++++++++++------- src/scripts/darwin.sh | 2 +- src/scripts/linux.sh | 12 ++++++++++-- src/scripts/win32.ps1 | 2 +- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 485090b2..46a13d1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2249,12 +2249,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2269,17 +2271,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -2396,7 +2401,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -2408,6 +2414,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2422,6 +2429,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2429,12 +2437,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -2453,6 +2463,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -2533,7 +2544,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -2545,6 +2557,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -2666,6 +2679,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 176a262d..e30d2e86 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -34,7 +34,7 @@ ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||") sudo chmod 777 "$ini_file" mkdir -p "$(pecl config-get ext_dir)" composer global require hirak/prestissimo >/dev/null 2>&1 -add_log "$tick" "PHP" "Installed PHP$version" +add_log "$tick" "PHP" "Installed PHP $(php -v | head -n 1 | cut -c 5-10)" add_log "$tick" "Composer" "Installed" add_extension() { diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index eab758d8..760c4b47 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -18,7 +18,6 @@ add_log() { } existing_version=$(php-config --version | cut -c 1-3) version=$1 -status="Switched to PHP$version" step_log "Setup PHP and Composer" sudo mkdir -p /var/run sudo mkdir -p /run/php @@ -30,7 +29,9 @@ if [ "$existing_version" != "$1" ]; then else sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1" php"$1"-phpdbg php"$1"-xml curl php"$1"-curl >/dev/null 2>&1 fi - status="Installed PHP$version" + status="installed" + else + status="switched" fi for tool in php phar phar.phar php-cgi php-config phpize phpdbg; do @@ -38,6 +39,13 @@ if [ "$existing_version" != "$1" ]; then sudo update-alternatives --set $tool /usr/bin/"$tool$1" >/dev/null 2>&1 fi done + if [ "$status" != "switched" ]; then + status="Installed PHP $(php -v | head -n 1 | cut -c 5-10)" + else + status="Switched to PHP $(php -v | head -n 1 | cut -c 5-10)" + fi +else + status="PHP $(php -v | head -n 1 | cut -c 5-10) Found" fi ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 593cbecd..70a8a95e 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -39,7 +39,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version $status = "Installed PHP $($installed.FullVersion)" } else { - $status = "Switched to PHP $($installed.FullVersion)" + $status = "PHP $($installed.FullVersion) Found" } Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir