Show semantic versions on PHP install and correct logs

This commit is contained in:
Shivam Mathur 2019-11-30 05:58:14 +05:30
parent ddcacf4760
commit 7f32ab318e
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 33 additions and 11 deletions

28
package-lock.json generated
View File

@ -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",

View File

@ -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() {

View File

@ -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")

View File

@ -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