From e63d25d41f0de6e5d06bbeeb97ac5929f207318d Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Wed, 29 Jul 2020 12:38:39 +0530 Subject: [PATCH] Use blackfire API to get versions --- src/scripts/ext/blackfire.ps1 | 3 +-- src/scripts/win32.ps1 | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/scripts/ext/blackfire.ps1 b/src/scripts/ext/blackfire.ps1 index bf3e0725..f889881d 100644 --- a/src/scripts/ext/blackfire.ps1 +++ b/src/scripts/ext/blackfire.ps1 @@ -10,8 +10,7 @@ Function Add-Blackfire() { $no_dot_version = $version.replace('.', '') $extension_version = $extension.split('-')[1] if ($extension_version -notmatch "\S") { - $ext_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '' | Select-Object -Index 2 } - $extension_version = [regex]::Matches($ext_data, '(.+)') | ForEach-Object { $_.Captures[0].Groups[1].value } + $extension_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).probe.php } if (Test-Path $ext_dir\blackfire.dll) { Enable-PhpExtension -Extension blackfire -Path $php_dir diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index d5ab1335..a097ac1b 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -267,8 +267,7 @@ Function Add-Pecl() { # Function to add blackfire and blackfire-agent. Function Add-Blackfire() { - $agent_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '' | Select-Object -Index 0 } - $agent_version = [regex]::Matches($agent_data, '(.+)') | ForEach-Object {$_.Captures[0].Groups[1].value } + $agent_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).agent $url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip" Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1 Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1