mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 07:16:22 +07:00 
			
		
		
		
	Install VcRedist from GitHub
This commit is contained in:
		| @ -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 "https://github.com/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip" | ||||
|       Invoke-WebRequest -UseBasicParsing -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 { | ||||
| @ -96,16 +96,24 @@ Function Get-CleanPSProfile { | ||||
|   Add-ToProfile $profile $current_profile.replace('\', '\\') ". $current_profile" | ||||
| } | ||||
|  | ||||
| # Function to install PhpManager. | ||||
| Function Install-PhpManager() { | ||||
|   $module_path = "$bin_dir\PhpManager\PhpManager.psm1" | ||||
| # Function to install a powershell package from GitHub. | ||||
| Function Install-GitHubPackage() { | ||||
|   param( | ||||
|     [Parameter(Position = 0, Mandatory = $true)] | ||||
|     $package, | ||||
|     [Parameter(Position = 1, Mandatory = $true)] | ||||
|     $psm1_path, | ||||
|     [Parameter(Position = 2, Mandatory = $true)] | ||||
|     $url | ||||
|   ) | ||||
|   $module_path = "$bin_dir\$psm1_path.psm1" | ||||
|   if(-not (Test-Path $module_path -PathType Leaf)) { | ||||
|     $zip_file = "$bin_dir\PhpManager.zip" | ||||
|     Invoke-WebRequest -UseBasicParsing -Uri 'https://github.com/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip' -OutFile $zip_file | ||||
|     $zip_file = "$bin_dir\$package.zip" | ||||
|     Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $zip_file | ||||
|     Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force | ||||
|   } | ||||
|   Import-Module $module_path | ||||
|   Add-ToProfile $current_profile 'powershell-phpmanager' "Import-Module $module_path" | ||||
|   Add-ToProfile $current_profile "$package-search" "Import-Module $module_path" | ||||
| } | ||||
|  | ||||
| # Function to add PHP extensions. | ||||
| @ -319,6 +327,7 @@ $cross = ([char]10007) | ||||
| $php_dir = 'C:\tools\php' | ||||
| $ext_dir = "$php_dir\ext" | ||||
| $bin_dir = $php_dir | ||||
| $github = 'https://github.com' | ||||
| $composer_bin = "$env:APPDATA\Composer\vendor\bin" | ||||
| $current_profile = "$env:TEMP\setup-php.ps1" | ||||
| $ProgressPreference = 'SilentlyContinue' | ||||
| @ -362,7 +371,7 @@ if($env:RUNNER -eq 'self-hosted') { | ||||
|  | ||||
| Add-Printf >$null 2>&1 | ||||
| Step-Log "Setup PhpManager" | ||||
| Install-PhpManager >$null 2>&1 | ||||
| Install-GitHubPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" >$null 2>&1 | ||||
| Add-Log $tick "PhpManager" "Installed" | ||||
|  | ||||
| Step-Log "Setup PHP" | ||||
| @ -375,7 +384,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) { | ||||
| $status = "Installed" | ||||
| 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 (Get-InstalledModule).Name -notcontains 'VcRedist') { | ||||
|     Install-Module -Name VcRedist -Force | ||||
|     Install-GitHubPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1 | ||||
|   } | ||||
|   if ($version -match $nightly_version) { | ||||
|     Invoke-WebRequest -UseBasicParsing -Uri https://dl.bintray.com/shivammathur/php/Install-PhpNightly.ps1 -OutFile $php_dir\Install-PhpNightly.ps1 > $null 2>&1 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur