mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve web requests
This commit is contained in:
parent
d812e938ac
commit
787c534f64
@ -2,7 +2,7 @@
|
||||
self_hosted_helper() {
|
||||
if ! command -v brew >/dev/null; then
|
||||
step_log "Setup Brew"
|
||||
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1
|
||||
get -q -e "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" && /tmp/install.sh >/dev/null 2>&1
|
||||
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
||||
fi
|
||||
}
|
||||
@ -88,7 +88,7 @@ update_dependencies() {
|
||||
if [[ "$version" =~ ${nightly_versions:?} ]] && [ "${runner:?}" != "self-hosted" ]; then
|
||||
tap_dir="$(brew --prefix)/Homebrew/Library/Taps"
|
||||
while read -r formula; do
|
||||
curl -o "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "${curl_opts[@]:?}" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb" &
|
||||
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb" &
|
||||
to_wait+=($!)
|
||||
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||
wait "${to_wait[@]}"
|
||||
@ -115,7 +115,7 @@ setup_php() {
|
||||
step_log "Setup PHP"
|
||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||
if [[ "$version" =~ ${old_versions:?} ]]; then
|
||||
curl "${curl_opts[@]:?}" "${github:?}/php5-darwin/releases/latest/download/install.sh" | bash -s "${version/./}" >/dev/null 2>&1
|
||||
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
|
||||
status="Installed"
|
||||
elif [ "$existing_version" != "$version" ]; then
|
||||
add_php "install" >/dev/null 2>&1
|
||||
|
@ -17,7 +17,7 @@ Function Add-Blackfire() {
|
||||
$status="Enabled"
|
||||
} else {
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
||||
Invoke-WebRequest -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
$status="Installed and enabled"
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ add_blackfire() {
|
||||
blackfire_ini_file="${scan_dir:?}/50-blackfire.ini"
|
||||
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
||||
if [ "$extension_version" = "blackfire" ]; then
|
||||
extension_version=$(curl -sSL https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||
fi
|
||||
sudo curl -o "${ext_dir:?}/blackfire.so" "${curl_opts[@]:?}" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
|
||||
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
|
||||
fi
|
||||
echo "extension=blackfire.so" | sudo tee -a "$blackfire_ini_file" >/dev/null 2>&1
|
||||
add_extension_log "$extension-$extension_version" "Installed and enabled"
|
||||
|
@ -2,7 +2,7 @@
|
||||
install_icu() {
|
||||
icu=$1
|
||||
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
|
||||
sudo curl -o /tmp/icu.tar.zst -sL "https://dl.bintray.com/shivammathur/icu4c/icu4c-$icu.tar.zst"
|
||||
get -q -n /tmp/icu.tar.zst "https://dl.bintray.com/shivammathur/icu4c/icu4c-$icu.tar.zst"
|
||||
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
|
||||
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
|
||||
fi
|
||||
@ -11,12 +11,12 @@ install_icu() {
|
||||
# Function to add ext-intl with the given version of ICU
|
||||
add_intl() {
|
||||
icu=$(echo "$1" | cut -d'-' -f 2)
|
||||
supported_version=$(curl "${curl_opts[@]:?}" https://api.bintray.com/packages/shivammathur/icu4c/icu4c | grep -Po "$icu" | head -n 1)
|
||||
supported_version=$(get -s -n "" https://api.bintray.com/packages/shivammathur/icu4c/icu4c | grep -Po "$icu" | head -n 1)
|
||||
if [ "$icu" != "$supported_version" ]; then
|
||||
add_log "${cross:?}" "intl" "ICU $icu is not supported"
|
||||
else
|
||||
install_icu "$icu" >/dev/null 2>&1
|
||||
sudo curl "${curl_opts[@]:?}" -o "${ext_dir:?}/intl.so" "https://dl.bintray.com/shivammathur/icu4c/php${version:?}-intl-$icu.so"
|
||||
get -q -n "${ext_dir:?}/intl.so" "https://dl.bintray.com/shivammathur/icu4c/php${version:?}-intl-$icu.so"
|
||||
enable_extension intl extension
|
||||
add_extension_log intl "Installed and enabled with ICU $icu"
|
||||
fi
|
||||
|
@ -19,7 +19,7 @@ Function Add-Ioncube() {
|
||||
if (-not($installed.ThreadSafe)) {
|
||||
$ts_part = "_nonts"
|
||||
}
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
||||
Invoke-WebRequest -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
||||
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
||||
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ add_ioncube() {
|
||||
if [ ! -e "${ext_dir:?}/ioncube.so" ]; then
|
||||
status='Installed and enabled'
|
||||
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
|
||||
curl "${curl_opts[@]:?}" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
|
||||
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
|
||||
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "$ext_dir/ioncube.so"
|
||||
fi
|
||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
||||
|
@ -14,7 +14,7 @@ Function Add-InstantClient() {
|
||||
if ($arch -eq 'x86') {
|
||||
$suffix = 'nt'
|
||||
}
|
||||
Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
||||
Invoke-WebRequest -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
||||
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
||||
Copy-Item $php_dir\instantclient*\* $php_dir
|
||||
}
|
||||
@ -44,7 +44,7 @@ Function Add-Oci() {
|
||||
$ociVersion = '2.0.12'
|
||||
}
|
||||
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
||||
Invoke-WebRequest -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
||||
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ add_client() {
|
||||
arch='macos'
|
||||
lib_ext='dylib'
|
||||
fi
|
||||
curl -o "/opt/oracle/$package.zip" "${curl_opts[@]:?}" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
||||
get -q -n "/opt/oracle/$package.zip" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
||||
unzip "/opt/oracle/$package.zip" -d "$oracle_home"
|
||||
done
|
||||
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
|
||||
@ -44,7 +44,7 @@ add_client() {
|
||||
|
||||
# Function to get PHP source.
|
||||
get_php() {
|
||||
[ ! -d "/opt/oracle/php-src-$tag" ] && curl "${curl_opts[@]}" "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "$oracle_home/"
|
||||
[ ! -d "/opt/oracle/php-src-$tag" ] && get -s -n "" "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "$oracle_home/"
|
||||
}
|
||||
|
||||
# Function to get phpize location on darwin.
|
||||
@ -73,7 +73,7 @@ restore_phpize() {
|
||||
|
||||
# Function to patch pdo_oci.
|
||||
patch_pdo_oci_config() {
|
||||
curl -O "${curl_opts[@]}" https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
||||
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
||||
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
||||
fi
|
||||
|
@ -5,9 +5,9 @@ Function Add-PhalconHelper() {
|
||||
} else {
|
||||
$domain = 'https://github.com'
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
||||
$match = Invoke-WebRequest -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
||||
$zip_file = $match.Matches[0].Groups[1].Value
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
||||
Invoke-WebRequest -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||
|
@ -141,7 +141,7 @@ add_extension_from_source() {
|
||||
(
|
||||
add_devtools phpize
|
||||
delete_extension "$extension"
|
||||
curl -o /tmp/"$extension".tar.gz "${curl_opts[@]:?}" https://github.com/"$repo"/archive/"$release".tar.gz
|
||||
get -q -n "/tmp/$extension.tar.gz" "https://github.com/$repo/archive/$release.tar.gz"
|
||||
tar xf /tmp/"$extension".tar.gz -C /tmp
|
||||
cd /tmp/"$extension-$release" || exit 1
|
||||
phpize && ./configure "$args" && make -j"$(nproc)" && sudo make install
|
||||
@ -166,12 +166,12 @@ add_devtools() {
|
||||
|
||||
# Function to setup the nightly build from shivammathur/php-builder
|
||||
setup_nightly() {
|
||||
curl "${curl_opts[@]:?}" "${github:?}"/php-builder/releases/latest/download/install.sh | bash -s "$runner" "$version"
|
||||
run_script "php-builder" "$runner" "$version"
|
||||
}
|
||||
|
||||
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
||||
setup_old_versions() {
|
||||
curl "${curl_opts[@]:?}" "${github:?}"/php5-ubuntu/releases/latest/download/install.sh | bash -s "$version"
|
||||
run_script "php5-ubuntu" "$version"
|
||||
configure_pecl
|
||||
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
||||
}
|
||||
@ -205,7 +205,7 @@ add_packaged_php() {
|
||||
IFS=' ' read -r -a packages <<<"$(echo "cli curl mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
|
||||
$apt_install "${packages[@]}"
|
||||
else
|
||||
curl "${curl_opts[@]:?}" "${github:?}"/php-ubuntu/releases/latest/download/install.sh | bash -s "$version"
|
||||
run_script "php-ubuntu" "$version"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ Function Add-Blackfire() {
|
||||
}
|
||||
$agent_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).agent
|
||||
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
||||
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
||||
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
||||
Add-ToProfile $current_profile 'blackfire-agent' "New-Alias blackfire-agent $bin_dir\blackfire-agent.exe"
|
||||
|
@ -1,6 +1,6 @@
|
||||
add_blackfire_linux() {
|
||||
sudo mkdir -p /var/run/blackfire
|
||||
sudo curl "${curl_opts[@]:?}" https://packages.blackfire.io/gpg.key | sudo apt-key add -
|
||||
get -s -n "" https://packages.blackfire.io/gpg.key | sudo apt-key add -
|
||||
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list
|
||||
sudo "${debconf_fix:?}" apt-get update
|
||||
${apt_install:?} blackfire-agent
|
||||
|
@ -3,7 +3,7 @@ add_bazel() {
|
||||
os=$(uname -s)
|
||||
if [ "$os" = "Linux" ]; then
|
||||
${apt_install:?} curl gnupg
|
||||
curl "${curl_opts[@]:?}" https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
|
||||
get -s -n "" https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
|
||||
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
|
||||
sudo "${debconf_fix:?}" apt-get update -y
|
||||
${apt_install:?} bazel
|
||||
@ -15,13 +15,13 @@ add_bazel() {
|
||||
|
||||
get_grpc_tag() {
|
||||
if [ "$grpc_tag" = "latest" ]; then
|
||||
grpc_tag=$(curl "${curl_opts[@]:?}" https://grpc.io/release)
|
||||
grpc_tag=$(get -s -n "" https://grpc.io/release)
|
||||
else
|
||||
status_code=$(sudo curl -s -w "%{http_code}" -o /tmp/grpc.tmp "${curl_opts[@]:?}" "https://github.com/grpc/grpc/releases/tag/v$grpc_tag")
|
||||
status_code=$(get -v -n /tmp/grpc.tmp "https://github.com/grpc/grpc/releases/tag/v$grpc_tag")
|
||||
if [ "$status_code" = "200" ]; then
|
||||
grpc_tag="v$grpc_tag"
|
||||
else
|
||||
grpc_tag=$(curl "${curl_opts[@]:?}" https://grpc.io/release)
|
||||
grpc_tag=$(get -s -n "" https://grpc.io/release)
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -30,7 +30,7 @@ add_grpc_php_plugin() {
|
||||
grpc_tag=$1
|
||||
get_grpc_tag
|
||||
(
|
||||
curl "${curl_opts[@]:?}" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp
|
||||
get -s -n "" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp
|
||||
cd "/tmp/grpc-${grpc_tag:1}" || exit
|
||||
add_bazel
|
||||
echo "os: $os"
|
||||
|
@ -27,7 +27,7 @@ Function Add-Protoc() {
|
||||
$arch_num = '32'
|
||||
}
|
||||
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
||||
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
||||
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||
|
@ -1,12 +1,12 @@
|
||||
get_protobuf_tag() {
|
||||
if [ "$protobuf_tag" = "latest" ]; then
|
||||
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
||||
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
||||
else
|
||||
status_code=$(sudo curl -s -w "%{http_code}" -o /tmp/protobuf.tmp "${curl_opts[@]:?}" "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
||||
status_code=$(get -v -n /tmp/protobuf.tmp "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
||||
if [ "$status_code" = "200" ]; then
|
||||
protobuf_tag="v$protobuf_tag"
|
||||
else
|
||||
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
||||
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -17,7 +17,7 @@ add_protoc() {
|
||||
(
|
||||
platform='linux'
|
||||
[ "$(uname -s)" = "Darwin" ] && platform='osx'
|
||||
curl -o /tmp/protobuf.zip "${curl_opts[@]:?}" "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip"
|
||||
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip"
|
||||
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
||||
sudo chmod 777 /usr/local/bin/protoc -R /usr/local/include/google
|
||||
) >/dev/null 2>&1
|
||||
|
@ -79,7 +79,7 @@ Function Add-Printf {
|
||||
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
||||
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe
|
||||
} else {
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
||||
Invoke-WebRequest -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
||||
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force
|
||||
}
|
||||
} else {
|
||||
@ -109,7 +109,7 @@ Function Install-PSPackage() {
|
||||
$module_path = "$bin_dir\$psm1_path.psm1"
|
||||
if(-not (Test-Path $module_path -PathType Leaf)) {
|
||||
$zip_file = "$bin_dir\$package.zip"
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $zip_file
|
||||
Invoke-WebRequest -Uri $url -OutFile $zip_file
|
||||
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force
|
||||
}
|
||||
Import-Module $module_path
|
||||
@ -250,16 +250,16 @@ Function Add-Tool() {
|
||||
}
|
||||
if($url.Count -gt 1) { $url = $url[0] }
|
||||
if ($tool -eq "symfony") {
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\$tool.exe
|
||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\$tool.exe
|
||||
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.exe" >$null 2>&1
|
||||
} else {
|
||||
try {
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\$tool
|
||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\$tool
|
||||
} catch {
|
||||
if($url -match '.*github.com.*releases.*latest.*') {
|
||||
try {
|
||||
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Invoke-WebRequest -UseBasicParsing -Uri ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\$tool
|
||||
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Invoke-WebRequest -Uri ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\$tool
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,6 @@ $ProgressPreference = 'SilentlyContinue'
|
||||
$nightly_version = '8.[0-9]'
|
||||
$cert_source='CurrentUser'
|
||||
$enable_extensions = ('openssl', 'curl', 'mbstring')
|
||||
$wc = New-Object System.Net.WebClient
|
||||
|
||||
$arch = 'x64'
|
||||
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||
@ -397,7 +396,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
||||
}
|
||||
if ($version -match $nightly_version) {
|
||||
$wc.DownloadFile("$bintray/Get-PhpNightly.ps1", "$php_dir\Get-PhpNightly.ps1") > $null 2>&1
|
||||
Invoke-WebRequest -Uri $bintray/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
||||
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
||||
} else {
|
||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
||||
@ -414,7 +413,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
||||
$installed = Get-Php -Path $php_dir
|
||||
('date.timezone=UTC', 'memory_limit=-1') | foreach { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
|
||||
if($version -lt "5.5") {
|
||||
('libeay32.dll', 'ssleay32.dll') | ForEach { $wc.DownloadFile("$bintray/$_", "$php_dir\$_") >$null 2>&1 }
|
||||
('libeay32.dll', 'ssleay32.dll') | ForEach { Invoke-WebRequest -Uri $bintray/$_ -OutFile $php_dir\$_ >$null 2>&1 }
|
||||
} else {
|
||||
$enable_extensions += ('opcache')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user