mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 15:26:23 +07:00 
			
		
		
		
	Remove unnecessary dist parameter
This commit is contained in:
		| @ -64,7 +64,7 @@ add_brew_tap() { | ||||
| add_brew_extension() { | ||||
|   formula=$1 | ||||
|   prefix=$2 | ||||
|   extension=$(grep "$formula=" "$dist"/../src/configs/brew_extensions | cut -d '=' -f 2) | ||||
|   extension=$(grep "$formula=" "$src"/configs/brew_extensions | cut -d '=' -f 2) | ||||
|   [[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")" | ||||
|   enable_extension "$extension" "$prefix" | ||||
|   if check_extension "$extension"; then | ||||
| @ -240,7 +240,7 @@ setup_php() { | ||||
|     exit 1 | ||||
|   fi | ||||
|  | ||||
|   sudo cp "$dist"/../src/configs/pm/*.json "$RUNNER_TOOL_CACHE/" | ||||
|   sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/" | ||||
|   echo "::set-output name=php-version::$semver" | ||||
|   add_log "$tick" "PHP" "$status PHP $semver$extra_version" | ||||
| } | ||||
| @ -248,7 +248,7 @@ setup_php() { | ||||
| # Variables | ||||
| version=${1:-'8.1'} | ||||
| ini=${2:-'production'} | ||||
| dist=$3 | ||||
| src=${0%/*}/.. | ||||
| php_formula=shivammathur/php/php@"$version" | ||||
| brew_path="$(command -v brew)" | ||||
| brew_path_dir="$(dirname "$brew_path")" | ||||
| @ -256,7 +256,7 @@ brew_prefix="$brew_path_dir"/.. | ||||
| brew_repo="$brew_path_dir/$(dirname "$(readlink "$brew_path")")"/.. | ||||
| tap_dir="$brew_repo"/Library/Taps | ||||
| core_repo="$tap_dir"/homebrew/homebrew-core | ||||
| scripts="${dist}"/../src/scripts | ||||
| scripts="$src"/scripts | ||||
| ext_tap=shivammathur/homebrew-extensions | ||||
| php_tap=shivammathur/homebrew-php | ||||
| export HOMEBREW_CHANGE_ARCH_TO_ARM=1 | ||||
|  | ||||
| @ -82,7 +82,7 @@ Function Add-Extension { | ||||
|  | ||||
| # Function to get a map of extensions and their dependent shared extensions. | ||||
| Function Get-ExtensionMap { | ||||
|   php -d'error_reporting=0' $dist\..\src\scripts\extensions\extension_map.php $env:TEMP\map$version.orig | ||||
|   php -d'error_reporting=0' $src\scripts\extensions\extension_map.php $env:TEMP\map$version.orig | ||||
| } | ||||
|  | ||||
| # Function to enable extension dependencies which are also extensions. | ||||
|  | ||||
| @ -49,7 +49,7 @@ enable_extension() { | ||||
|  | ||||
| # Function to get a map of extensions and their dependent shared extensions. | ||||
| get_extension_map() { | ||||
|   php -d'error_reporting=0' "${dist:?}"/../src/scripts/extensions/extension_map.php /tmp/map"$version".orig | ||||
|   php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig | ||||
| } | ||||
|  | ||||
| # Function to enable extension dependencies which are also extensions. | ||||
|  | ||||
| @ -130,7 +130,7 @@ switch_version() { | ||||
| add_packaged_php() { | ||||
|   if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then | ||||
|     add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php | ||||
|     IFS=' ' read -r -a packages <<<"$(sed "s/[^ ]*/php$version-&/g" "$dist"/../src/configs/php_packages | tr '\n' ' ')" | ||||
|     IFS=' ' read -r -a packages <<<"$(sed "s/[^ ]*/php$version-&/g" "$src"/configs/php_packages | tr '\n' ' ')" | ||||
|     install_packages "${packages[@]}" | ||||
|   else | ||||
|     run_script "php-ubuntu" "$version" | ||||
| @ -241,7 +241,7 @@ setup_php() { | ||||
|   configure_php | ||||
|   sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1 | ||||
|   sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}" | ||||
|   sudo cp "$dist"/../src/configs/pm/*.json "$RUNNER_TOOL_CACHE/" | ||||
|   sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/" | ||||
|   echo "::set-output name=php-version::$semver" | ||||
|   add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version" | ||||
| } | ||||
| @ -249,10 +249,10 @@ setup_php() { | ||||
| # Variables | ||||
| version=${1:-'8.1'} | ||||
| ini=${2:-'production'} | ||||
| dist=$3 | ||||
| src=${0%/*}/.. | ||||
| debconf_fix="DEBIAN_FRONTEND=noninteractive" | ||||
| apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends" | ||||
| scripts="${dist}"/../src/scripts | ||||
| scripts="$src"/scripts | ||||
|  | ||||
| add_sudo | ||||
|  | ||||
|  | ||||
| @ -22,7 +22,7 @@ Function Edit-ComposerConfig() { | ||||
|   if (-not(Test-Path $composer_json)) { | ||||
|     Set-Content -Path $composer_json -Value "{}" | ||||
|   } | ||||
|   Add-EnvPATH $dist\..\src\configs\composer.env | ||||
|   Add-EnvPATH $src\configs\composer.env | ||||
|   Add-Path $composer_bin | ||||
|   if (Test-Path env:COMPOSER_TOKEN) { | ||||
|     Add-Env COMPOSER_AUTH ('{"github-oauth": {"github.com": "' + $env:COMPOSER_TOKEN + '"}}') | ||||
|  | ||||
| @ -42,7 +42,7 @@ configure_composer() { | ||||
|     echo '{}' | tee "$composer_json" >/dev/null | ||||
|     chmod 644 "$composer_json" | ||||
|   fi | ||||
|   add_env_path "${dist:?}"/../src/configs/composer.env | ||||
|   add_env_path "${src:?}"/configs/composer.env | ||||
|   add_path "$composer_bin" | ||||
|   if [ -n "$COMPOSER_TOKEN" ]; then | ||||
|     add_env COMPOSER_AUTH '{"github-oauth": {"github.com": "'"$COMPOSER_TOKEN"'"}}' | ||||
|  | ||||
| @ -136,7 +136,7 @@ self_hosted_setup() { | ||||
| # Function to configure PHP | ||||
| configure_php() { | ||||
|   add_php_config | ||||
|   ini_config_dir="${dist:?}"/../src/configs/ini | ||||
|   ini_config_dir="${src:?}"/configs/ini | ||||
|   ini_files=("$ini_config_dir"/php.ini) | ||||
|   [[ "$version" =~ $jit_versions ]] && ini_files+=("$ini_config_dir"/jit.ini) | ||||
|   [[ "$version" =~ $xdebug3_versions ]] && ini_files+=("$ini_config_dir"/xdebug.ini) | ||||
|  | ||||
| @ -8,12 +8,7 @@ param ( | ||||
|   [ValidateNotNull()] | ||||
|   [ValidateLength(1, [int]::MaxValue)] | ||||
|   [string] | ||||
|   $ini = 'production', | ||||
|   [Parameter(Position = 2, Mandatory = $true)] | ||||
|   [ValidateNotNull()] | ||||
|   [ValidateLength(1, [int]::MaxValue)] | ||||
|   [string] | ||||
|   $dist | ||||
|   $ini = 'production' | ||||
| ) | ||||
|  | ||||
| # Function to log start of a operation. | ||||
| @ -178,7 +173,7 @@ Function Add-PhpConfig { | ||||
|     Set-Content -Path $php_dir\php.ini -Value '' | ||||
|   } | ||||
|   Set-Content -Path $php_dir\php.ini-current -Value $ini | ||||
|   $ini_config_dir = "$dist\..\src\configs\ini" | ||||
|   $ini_config_dir = "$src\configs\ini" | ||||
|   $ini_files = @("$ini_config_dir\php.ini") | ||||
|   $version -match $jit_versions -and ($ini_files += ("$ini_config_dir\jit.ini")) > $null 2>&1 | ||||
|   $version -match $xdebug3_versions -and ($ini_files += ("$ini_config_dir\xdebug.ini")) > $null 2>&1 | ||||
| @ -261,8 +256,9 @@ if($env:RUNNER -eq 'self-hosted' -or (-not($env:ImageOS) -and -not($env:ImageVer | ||||
|   } | ||||
| } | ||||
|  | ||||
| . $dist\..\src\scripts\tools\add_tools.ps1 | ||||
| . $dist\..\src\scripts\extensions\add_extensions.ps1 | ||||
| $src = Join-Path -Path $PSScriptRoot -ChildPath \.. | ||||
| . $src\scripts\tools\add_tools.ps1 | ||||
| . $src\scripts\extensions\add_extensions.ps1 | ||||
|  | ||||
| Add-Printf >$null 2>&1 | ||||
| Step-Log "Setup PhpManager" | ||||
| @ -319,6 +315,6 @@ if($version -lt "5.5") { | ||||
| } | ||||
| Enable-PhpExtension -Extension $enable_extensions -Path $php_dir | ||||
| Add-PhpCAInfo | ||||
| Copy-Item -Path $dist\..\src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE | ||||
| Copy-Item -Path $src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE | ||||
| Write-Output "::set-output name=php-version::$($installed.FullVersion)" | ||||
| Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)$extra_version" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur