mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 15:26:23 +07:00 
			
		
		
		
	Add fallback to Install-PSPackage in win32.ps1
This commit is contained in:
		| @ -63,7 +63,9 @@ Function Install-PSPackage() { | |||||||
|     [Parameter(Position = 1, Mandatory = $true)] |     [Parameter(Position = 1, Mandatory = $true)] | ||||||
|     $psm1_path, |     $psm1_path, | ||||||
|     [Parameter(Position = 2, Mandatory = $true)] |     [Parameter(Position = 2, Mandatory = $true)] | ||||||
|     $url |     $url, | ||||||
|  |     [Parameter(Position = 3, Mandatory = $true)] | ||||||
|  |     $cmdlet | ||||||
|   ) |   ) | ||||||
|   $module_path = "$php_dir\$psm1_path.psm1" |   $module_path = "$php_dir\$psm1_path.psm1" | ||||||
|   if(-not (Test-Path $module_path -PathType Leaf)) { |   if(-not (Test-Path $module_path -PathType Leaf)) { | ||||||
| @ -73,6 +75,10 @@ Function Install-PSPackage() { | |||||||
|   } |   } | ||||||
|   Import-Module $module_path |   Import-Module $module_path | ||||||
|   Add-ToProfile $current_profile "$package-search" "Import-Module $module_path" |   Add-ToProfile $current_profile "$package-search" "Import-Module $module_path" | ||||||
|  |  | ||||||
|  |   if($null -eq (Get-Command $cmdlet -ErrorAction SilentlyContinue)) { | ||||||
|  |     Install-Module -Name $cmdlet -Force | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| Function Add-Extension { | Function Add-Extension { | ||||||
| @ -273,6 +279,9 @@ $composer_json = "$env:APPDATA\Composer\composer.json" | |||||||
| $composer_lock = "$env:APPDATA\Composer\composer.lock" | $composer_lock = "$env:APPDATA\Composer\composer.lock" | ||||||
| $master_version = '8.0' | $master_version = '8.0' | ||||||
| $arch = 'x64' | $arch = 'x64' | ||||||
|  | if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') { | ||||||
|  |   $arch = 'x86' | ||||||
|  | } | ||||||
| $ts = $env:PHPTS -eq 'ts' | $ts = $env:PHPTS -eq 'ts' | ||||||
| if($env:PHPTS -ne 'ts') { | if($env:PHPTS -ne 'ts') { | ||||||
|   $env:PHPTS = 'nts' |   $env:PHPTS = 'nts' | ||||||
| @ -283,7 +292,7 @@ if(-not(Test-Path -LiteralPath $current_profile)) { | |||||||
|  |  | ||||||
| Add-Printf >$null 2>&1 | Add-Printf >$null 2>&1 | ||||||
| Step-Log "Setup PhpManager" | Step-Log "Setup PhpManager" | ||||||
| Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" >$null 2>&1 | Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1 | ||||||
| Add-Log $tick "PhpManager" "Installed" | Add-Log $tick "PhpManager" "Installed" | ||||||
|  |  | ||||||
| Step-Log "Setup PHP" | Step-Log "Setup PHP" | ||||||
| @ -295,9 +304,8 @@ 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') { |   if ($version -lt '7.0' -and (Get-InstalledModule).Name -notcontains 'VcRedist') { | ||||||
|     Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1 |     Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1 | ||||||
|     $arch='x86' |  | ||||||
|   } |   } | ||||||
|   try { |   try { | ||||||
|     if ($version -eq $master_version) { |     if ($version -eq $master_version) { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur