mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Release v1-verbose
This commit is contained in:
parent
28c92ba4ee
commit
bc71c880ee
@ -207,9 +207,9 @@ describe('Utils tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking suppressOutput', async () => {
|
it('checking suppressOutput', async () => {
|
||||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
expect(await utils.suppressOutput('win32')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('linux')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('darwin')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
expect(await utils.suppressOutput('openbsd')).toContain(
|
||||||
'Platform openbsd is not supported'
|
'Platform openbsd is not supported'
|
||||||
);
|
);
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -1023,10 +1023,10 @@ exports.getExtensionPrefix = getExtensionPrefix;
|
|||||||
async function suppressOutput(os_version) {
|
async function suppressOutput(os_version) {
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return ' >$null 2>&1';
|
return ' ';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return ' >/dev/null 2>&1';
|
return ' ';
|
||||||
default:
|
default:
|
||||||
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ add_log() {
|
|||||||
remove_extension() {
|
remove_extension() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
sudo rm -rf "$scan_dir"/*"$extension"*
|
||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test if extension is loaded
|
# Function to test if extension is loaded
|
||||||
@ -37,7 +37,7 @@ check_extension() {
|
|||||||
# Function to install PECL extensions and accept default options
|
# Function to install PECL extensions and accept default options
|
||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
yes '' | sudo pecl install -f "$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the PECL version
|
# Function to get the PECL version
|
||||||
@ -70,7 +70,7 @@ add_pecl_extension() {
|
|||||||
else
|
else
|
||||||
remove_extension "$extension"
|
remove_extension "$extension"
|
||||||
(
|
(
|
||||||
pecl_install "$extension-$pecl_version" >/dev/null 2>&1 &&
|
pecl_install "$extension-$pecl_version" &&
|
||||||
check_extension "$extension" &&
|
check_extension "$extension" &&
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
add_log "$tick" "$extension" "Installed and enabled"
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||||
@ -93,9 +93,9 @@ fetch_brew_tap() {
|
|||||||
add_brew_tap() {
|
add_brew_tap() {
|
||||||
tap=$1
|
tap=$1
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
fetch_brew_tap "$tap" >/dev/null 2>&1
|
fetch_brew_tap "$tap"
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ add_extension() {
|
|||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
(
|
(
|
||||||
eval "$install_command" >/dev/null 2>&1 &&
|
eval "$install_command" &&
|
||||||
check_extension "$extension" &&
|
check_extension "$extension" &&
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
add_log "$tick" "$extension" "Installed and enabled"
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
@ -188,15 +188,15 @@ add_tool() {
|
|||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
configure_composer "$tool_path"
|
configure_composer "$tool_path"
|
||||||
elif [ "$tool" = "phan" ]; then
|
elif [ "$tool" = "phan" ]; then
|
||||||
add_extension fileinfo "pecl_install fileinfo" extension >/dev/null 2>&1
|
add_extension fileinfo "pecl_install fileinfo" extension
|
||||||
add_extension ast "pecl_install ast" extension >/dev/null 2>&1
|
add_extension ast "pecl_install ast" extension
|
||||||
elif [ "$tool" = "phive" ]; then
|
elif [ "$tool" = "phive" ]; then
|
||||||
add_extension curl "pecl_install curl" extension >/dev/null 2>&1
|
add_extension curl "pecl_install curl" extension
|
||||||
add_extension mbstring "pecl_install mbstring" extension >/dev/null 2>&1
|
add_extension mbstring "pecl_install mbstring" extension
|
||||||
add_extension xml "pecl_install xml" extension >/dev/null 2>&1
|
add_extension xml "pecl_install xml" extension
|
||||||
elif [ "$tool" = "cs2pr" ]; then
|
elif [ "$tool" = "cs2pr" ]; then
|
||||||
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
||||||
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
|
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" && sudo mv "$tool_path.tmp" "$tool_path"
|
||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
fi
|
fi
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
@ -211,8 +211,8 @@ add_composertool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" || true
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" &&
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
if [ -e "$composer_bin/composer" ]; then
|
if [ -e "$composer_bin/composer" ]; then
|
||||||
@ -226,8 +226,8 @@ add_composertool() {
|
|||||||
# Function to configure PECL
|
# Function to configure PECL
|
||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
for tool in pear pecl; do
|
for tool in pear pecl; do
|
||||||
sudo "$tool" config-set php_ini "$ini_file" >/dev/null 2>&1
|
sudo "$tool" config-set php_ini "$ini_file"
|
||||||
sudo "$tool" channel-update "$tool".php.net >/dev/null 2>&1
|
sudo "$tool" channel-update "$tool".php.net
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ update_dependencies() {
|
|||||||
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
fi
|
fi
|
||||||
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
echo '' | sudo tee /tmp/update_dependencies
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
|||||||
# Setup PHP
|
# Setup PHP
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
if [ "$existing_version" != "$version" ]; then
|
if [ "$existing_version" != "$version" ]; then
|
||||||
setup_php >/dev/null 2>&1
|
setup_php
|
||||||
status="Installed"
|
status="Installed"
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
|
@ -13,7 +13,7 @@ add_gearman_helper() {
|
|||||||
# Function to add gearman extension.
|
# Function to add gearman extension.
|
||||||
add_gearman() {
|
add_gearman() {
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
add_gearman_helper >/dev/null 2>&1
|
add_gearman_helper
|
||||||
if check_extension gearman; then
|
if check_extension gearman; then
|
||||||
add_log "${tick:?}" "gearman" "$status"
|
add_log "${tick:?}" "gearman" "$status"
|
||||||
fi
|
fi
|
||||||
|
@ -13,7 +13,7 @@ add_log() {
|
|||||||
# Function to update php ppa
|
# Function to update php ppa
|
||||||
update_ppa() {
|
update_ppa() {
|
||||||
if [ "$ppa_updated" = "false" ]; then
|
if [ "$ppa_updated" = "false" ]; then
|
||||||
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
|
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::Etc::sourcelist="{}" ';'
|
||||||
ppa_updated="true"
|
ppa_updated="true"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ update_ppa() {
|
|||||||
install_phalcon() {
|
install_phalcon() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
version=$2
|
version=$2
|
||||||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ cross="✗"
|
|||||||
|
|
||||||
if [ "$extension_major_version" = "4" ]; then
|
if [ "$extension_major_version" = "4" ]; then
|
||||||
if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
||||||
echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=psr.so" | sudo tee -a "$ini_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
@ -45,7 +45,7 @@ if [ "$extension_major_version" = "4" ]; then
|
|||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
install_phalcon "$1" "$2"
|
install_phalcon "$1" "$2"
|
||||||
else
|
else
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=phalcon.so" | sudo tee -a "$ini_file"
|
||||||
add_log "$tick" "$1" "Enabled"
|
add_log "$tick" "$1" "Enabled"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -62,7 +62,7 @@ if [ "$extension_major_version" = "3" ]; then
|
|||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
install_phalcon "$1" "$2"
|
install_phalcon "$1" "$2"
|
||||||
else
|
else
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=phalcon.so" | sudo tee -a "$ini_file"
|
||||||
add_log "$tick" "$1" "Enabled"
|
add_log "$tick" "$1" "Enabled"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -39,10 +39,10 @@ add_ppa() {
|
|||||||
# Function to update the package lists.
|
# Function to update the package lists.
|
||||||
update_lists() {
|
update_lists() {
|
||||||
if [ ! -e /tmp/setup_php ]; then
|
if [ ! -e /tmp/setup_php ]; then
|
||||||
add_ppa ondrej/php >/dev/null 2>&1
|
add_ppa ondrej/php
|
||||||
cleanup_lists
|
cleanup_lists
|
||||||
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
sudo "$debconf_fix" apt-get update
|
||||||
echo '' | sudo tee /tmp/setup_php >/dev/null 2>&1
|
echo '' | sudo tee /tmp/setup_php
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,13 +50,13 @@ update_lists() {
|
|||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
if ! [ -e /tmp/pecl_config ]; then
|
if ! [ -e /tmp/pecl_config ]; then
|
||||||
if ! command -v pecl >/dev/null || ! command -v pear >/dev/null; then
|
if ! command -v pecl >/dev/null || ! command -v pear >/dev/null; then
|
||||||
add_pecl >/dev/null 2>&1
|
add_pecl
|
||||||
fi
|
fi
|
||||||
for script in pear pecl; do
|
for script in pear pecl; do
|
||||||
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}" >/dev/null 2>&1
|
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}"
|
||||||
sudo "$script" channel-update "$script".php.net >/dev/null 2>&1
|
sudo "$script" channel-update "$script".php.net
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
echo '' | sudo tee /tmp/pecl_config
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ get_pecl_version() {
|
|||||||
# Function to install PECL extensions and accept default options
|
# Function to install PECL extensions and accept default options
|
||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
yes '' | sudo pecl install -f "$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to enable existing extensions.
|
# Function to enable existing extensions.
|
||||||
@ -102,8 +102,8 @@ delete_extension() {
|
|||||||
local extension=$1
|
local extension=$1
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
sudo rm -rf "$scan_dir"/*"$extension"*
|
||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so
|
||||||
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
|
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,8 +125,8 @@ add_extension() {
|
|||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
eval "$install_command" >/dev/null 2>&1 ||
|
eval "$install_command" ||
|
||||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
(update_lists && eval "$install_command" ) || pecl_install "$extension"
|
||||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
fi
|
fi
|
||||||
@ -149,7 +149,7 @@ add_pecl_extension() {
|
|||||||
else
|
else
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
(
|
(
|
||||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
sudo pecl install -f "$extension-$pecl_version" &&
|
||||||
check_extension "$extension" &&
|
check_extension "$extension" &&
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
add_log "$tick" "$extension" "Installed and enabled"
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||||
@ -216,9 +216,9 @@ add_tool() {
|
|||||||
elif [ "$tool" = "cs2pr" ]; then
|
elif [ "$tool" = "cs2pr" ]; then
|
||||||
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
||||||
elif [ "$tool" = "phive" ]; then
|
elif [ "$tool" = "phive" ]; then
|
||||||
add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1
|
add_extension curl "$apt_install php$version-curl" extension
|
||||||
add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
|
add_extension mbstring "$apt_install php$version-mbstring" extension
|
||||||
add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
|
add_extension xml "$apt_install php$version-xml" extension
|
||||||
fi
|
fi
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
else
|
else
|
||||||
@ -233,8 +233,8 @@ add_composertool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" || true
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" &&
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
if [ -e "$composer_bin/composer" ]; then
|
if [ -e "$composer_bin/composer" ]; then
|
||||||
@ -248,10 +248,10 @@ add_composertool() {
|
|||||||
# Function to setup phpize and php-config
|
# Function to setup phpize and php-config
|
||||||
add_devtools() {
|
add_devtools() {
|
||||||
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
||||||
update_lists && $apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
update_lists && $apt_install php"$version"-dev php"$version"-xml
|
||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
||||||
configure_pecl
|
configure_pecl
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ add_packaged_php() {
|
|||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_devtools
|
add_devtools
|
||||||
if [ ! -e /usr/bin/pecl ]; then
|
if [ ! -e /usr/bin/pecl ]; then
|
||||||
$apt_install php-pear >/dev/null 2>&1
|
$apt_install php-pear
|
||||||
fi
|
fi
|
||||||
configure_pecl
|
configure_pecl
|
||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
@ -330,16 +330,16 @@ sudo mkdir -m 777 -p "$HOME/.composer" /var/run /run/php
|
|||||||
if [ "$existing_version" != "$version" ]; then
|
if [ "$existing_version" != "$version" ]; then
|
||||||
if [ ! -e "/usr/bin/php$version" ]; then
|
if [ ! -e "/usr/bin/php$version" ]; then
|
||||||
if [ "$version" = "8.0" ]; then
|
if [ "$version" = "8.0" ]; then
|
||||||
setup_master >/dev/null 2>&1
|
setup_master
|
||||||
else
|
else
|
||||||
add_packaged_php >/dev/null 2>&1
|
add_packaged_php
|
||||||
fi
|
fi
|
||||||
status="Installed"
|
status="Installed"
|
||||||
else
|
else
|
||||||
status="Switched to"
|
status="Switched to"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
fi
|
fi
|
||||||
@ -353,9 +353,9 @@ scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
|||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
pecl_file="$scan_dir"/99-pecl.ini
|
pecl_file="$scan_dir"/99-pecl.ini
|
||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
echo '' | sudo tee "$pecl_file"
|
||||||
configure_php
|
configure_php
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit
|
||||||
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
||||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
|
@ -188,7 +188,7 @@ Function Add-Tool() {
|
|||||||
if($url.Count -gt 1) { $url = $url[0] }
|
if($url.Count -gt 1) { $url = $url[0] }
|
||||||
if ($tool -eq "symfony") {
|
if ($tool -eq "symfony") {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe"
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
||||||
@ -208,16 +208,16 @@ Function Add-Tool() {
|
|||||||
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
|
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
|
||||||
$bat_content += "php %BIN_TARGET% %*"
|
$bat_content += "php %BIN_TARGET% %*"
|
||||||
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat"
|
||||||
if($tool -eq "composer") {
|
if($tool -eq "composer") {
|
||||||
Edit-ComposerConfig $php_dir\$tool
|
Edit-ComposerConfig $php_dir\$tool
|
||||||
} elseif($tool -eq "cs2pr") {
|
} elseif($tool -eq "cs2pr") {
|
||||||
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
||||||
} elseif($tool -eq "phan") {
|
} elseif($tool -eq "phan") {
|
||||||
Add-Extension fileinfo >$null 2>&1
|
Add-Extension fileinfo
|
||||||
Add-Extension ast >$null 2>&1
|
Add-Extension ast
|
||||||
} elseif($tool -eq "phive") {
|
} elseif($tool -eq "phive") {
|
||||||
Add-Extension xml >$null 2>&1
|
Add-Extension xml
|
||||||
} elseif($tool -eq "wp-cli") {
|
} elseif($tool -eq "wp-cli") {
|
||||||
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
||||||
}
|
}
|
||||||
@ -286,12 +286,12 @@ if($env:PHPTS -ne 'ts') {
|
|||||||
$env:PHPTS = 'nts'
|
$env:PHPTS = 'nts'
|
||||||
}
|
}
|
||||||
if(-not(Test-Path -LiteralPath $current_profile)) {
|
if(-not(Test-Path -LiteralPath $current_profile)) {
|
||||||
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
New-Item -Path $current_profile -ItemType "file" -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
Add-Printf >$null 2>&1
|
Add-Printf
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1
|
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php
|
||||||
Add-Log $tick "PhpManager" "Installed"
|
Add-Log $tick "PhpManager" "Installed"
|
||||||
|
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
@ -304,7 +304,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
$status = "Installed"
|
$status = "Installed"
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
||||||
|
@ -305,10 +305,10 @@ export async function getExtensionPrefix(extension: string): Promise<string> {
|
|||||||
export async function suppressOutput(os_version: string): Promise<string> {
|
export async function suppressOutput(os_version: string): Promise<string> {
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return ' >$null 2>&1';
|
return ' ';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return ' >/dev/null 2>&1';
|
return ' ';
|
||||||
default:
|
default:
|
||||||
return await log(
|
return await log(
|
||||||
'Platform ' + os_version + ' is not supported',
|
'Platform ' + os_version + ' is not supported',
|
||||||
|
Loading…
Reference in New Issue
Block a user