Skip to content

Commit

Permalink
Fix phalcon5 support on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Mar 25, 2024
1 parent 719332a commit 66ec2c3
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/scripts/extensions/phalcon.ps1
Expand Up @@ -8,19 +8,36 @@ Function Get-PhalconReleaseAssetUrl() {
)
$domain = 'https://api.github.com/repos'
$releases = 'phalcon/cphalcon/releases'
$match = $null
if($extension_version -match '[3-4]') {
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
try {
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
} catch {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
} catch { }
if($null -eq $match) {
try {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
} catch { }
}
} else {
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
try {
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
if($null -eq $match) {
try {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
}
if($null -eq $match) {
try {
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
}
if($null -eq $match) {
try {
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
} catch { }
}
}
if($NULL -ne $match) {
Expand Down Expand Up @@ -54,6 +71,8 @@ Function Get-PhalconSemver() {
return '3.4.5'
} elseif (($extension_version -eq '4') -and ($version -eq '7.2')) {
return '4.1.0'
} elseif (($extension_version -eq '5') -and ($version -eq '7.4')) {
return '5.4.0'
}
return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
}
Expand Down

0 comments on commit 66ec2c3

Please sign in to comment.