Use blackfire API to get versions

This commit is contained in:
Shivam Mathur 2020-07-29 12:38:39 +05:30
parent 2a7ae24c8e
commit e63d25d41f
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 2 additions and 4 deletions

View File

@ -10,8 +10,7 @@ Function Add-Blackfire() {
$no_dot_version = $version.replace('.', '') $no_dot_version = $version.replace('.', '')
$extension_version = $extension.split('-')[1] $extension_version = $extension.split('-')[1]
if ($extension_version -notmatch "\S") { 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 '<td class="version">' | Select-Object -Index 2 } $extension_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).probe.php
$extension_version = [regex]::Matches($ext_data, '<td.*?>(.+)</td>') | ForEach-Object { $_.Captures[0].Groups[1].value }
} }
if (Test-Path $ext_dir\blackfire.dll) { if (Test-Path $ext_dir\blackfire.dll) {
Enable-PhpExtension -Extension blackfire -Path $php_dir Enable-PhpExtension -Extension blackfire -Path $php_dir

View File

@ -267,8 +267,7 @@ Function Add-Pecl() {
# Function to add blackfire and blackfire-agent. # Function to add blackfire and blackfire-agent.
Function Add-Blackfire() { Function Add-Blackfire() {
$agent_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '<td class="version">' | Select-Object -Index 0 } $agent_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).agent
$agent_version = [regex]::Matches($agent_data, '<td.*?>(.+)</td>') | ForEach-Object {$_.Captures[0].Groups[1].value }
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip" $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 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 Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1