From 66ec2c311de9f71a6919142f9779b71d781faa91 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Mon, 25 Mar 2024 06:33:54 +0530 Subject: [PATCH] Fix phalcon5 support on Windows --- src/scripts/extensions/phalcon.ps1 | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/scripts/extensions/phalcon.ps1 b/src/scripts/extensions/phalcon.ps1 index 3d00873ac..c82323b0f 100644 --- a/src/scripts/extensions/phalcon.ps1 +++ b/src/scripts/extensions/phalcon.ps1 @@ -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) { @@ -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 }