2021-04-20 18:48:15 +07:00
|
|
|
# Function to add blackfire cli.
|
2020-08-01 19:03:24 +07:00
|
|
|
Function Add-Blackfire() {
|
2020-09-06 16:00:37 +07:00
|
|
|
$arch_name ='amd64'
|
|
|
|
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
|
|
|
$arch_name = '386'
|
|
|
|
}
|
2021-04-20 18:48:15 +07:00
|
|
|
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
|
|
|
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
2020-11-11 03:53:45 +07:00
|
|
|
Invoke-WebRequest -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
2020-08-01 19:03:24 +07:00
|
|
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
|
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
|
|
|
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
2021-04-20 18:48:15 +07:00
|
|
|
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
|
2020-08-01 19:03:24 +07:00
|
|
|
}
|
|
|
|
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
2021-04-20 18:48:15 +07:00
|
|
|
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
2020-08-01 19:03:24 +07:00
|
|
|
}
|
2021-04-20 18:48:15 +07:00
|
|
|
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
2020-08-01 19:03:24 +07:00
|
|
|
}
|