mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 23:36:21 +07:00 
			
		
		
		
	Add support for blackfire client, agent and player
This commit is contained in:
		| @ -123,7 +123,7 @@ add_tool() { | ||||
| } | ||||
|  | ||||
| # Function to add a tool using composer | ||||
| add_composer_tool() { | ||||
| add_composertool() { | ||||
|   tool=$1 | ||||
|   release=$2 | ||||
|   prefix=$3 | ||||
| @ -134,6 +134,16 @@ add_composer_tool() { | ||||
|   ) || add_log "$cross" "$tool" "Could not setup $tool" | ||||
| } | ||||
|  | ||||
| add_blackfire() { | ||||
|   sudo mkdir -p usr/local/var/run | ||||
|   brew tap blackfireio/homebrew-blackfire >/dev/null 2>&1 | ||||
|   brew install blackfire-agent >/dev/null 2>&1 | ||||
|   sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1 | ||||
|   brew services start blackfire-agent >/dev/null 2>&1 | ||||
|   sudo blackfire --config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1 | ||||
|  | ||||
| } | ||||
|  | ||||
| # Function to configure PECL | ||||
| configure_pecl() { | ||||
|   for tool in pear pecl; do | ||||
|  | ||||
| @ -173,7 +173,7 @@ add_tool() { | ||||
| } | ||||
|  | ||||
| # Function to setup a tool using composer | ||||
| add_composer_tool() { | ||||
| add_composertool() { | ||||
|   tool=$1 | ||||
|   release=$2 | ||||
|   prefix=$3 | ||||
| @ -194,6 +194,18 @@ add_devtools() { | ||||
|   configure_pecl | ||||
| } | ||||
|  | ||||
| add_blackfire() { | ||||
|   sudo mkdir -p /var/run/blackfire | ||||
|   sudo curl -o /tmp/blackfire-gpg.key -sSL https://packages.blackfire.io/gpg.key >/dev/null 2>&1 | ||||
|   sudo apt-key add /tmp/blackfire-gpg.key >/dev/null 2>&1 | ||||
|   echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list >/dev/null 2>&1 | ||||
|   find /etc/apt/sources.list.d -type f -name blackfire.list -exec sudo "$debconf_fix" apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1 | ||||
|   $apt_install blackfire-agent >/dev/null 2>&1 | ||||
|   sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1 | ||||
|   sudo /etc/init.d/blackfire-agent restart >/dev/null 2>&1 | ||||
|   sudo blackfire --config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1 | ||||
| } | ||||
|  | ||||
| # Function to setup the nightly build from master branch | ||||
| setup_master() { | ||||
|   tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz | ||||
|  | ||||
| @ -103,7 +103,7 @@ Function Add-Tool() { | ||||
|   } | ||||
|   if ($tool -eq "symfony") { | ||||
|     Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe | ||||
|     Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" > $null 2>&1 | ||||
|     Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" >$null 2>&1 | ||||
|   } else { | ||||
|     try { | ||||
|       Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool | ||||
| @ -113,7 +113,7 @@ Function Add-Tool() { | ||||
|       $bat_content += "SET BIN_TARGET=%~dp0/" + $tool | ||||
|       $bat_content += "php %BIN_TARGET% %*" | ||||
|       Set-Content -Path $php_dir\$tool.bat -Value $bat_content | ||||
|       Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" > $null 2>&1 | ||||
|       Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1 | ||||
|     } catch { } | ||||
|   } | ||||
|   if($tool -eq "phive") { | ||||
| @ -134,7 +134,7 @@ Function Add-Tool() { | ||||
|   } | ||||
| } | ||||
|  | ||||
| Function Add-Composer-Tool() { | ||||
| Function Add-Composertool() { | ||||
|   Param ( | ||||
|     [Parameter(Position = 0, Mandatory = $true)] | ||||
|     [ValidateNotNull()] | ||||
| @ -162,10 +162,31 @@ Function Add-Composer-Tool() { | ||||
|   } | ||||
| } | ||||
|  | ||||
| Function Add-PECL() { | ||||
| Function Add-Pecl() { | ||||
|   Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows" | ||||
| } | ||||
|  | ||||
| Function Add-Blackfire() { | ||||
|   Param ( | ||||
|     [Parameter(Position = 0, Mandatory = $true)] | ||||
|     [ValidateNotNull()] | ||||
|     [ValidateLength(1, [int]::MaxValue)] | ||||
|     [string] | ||||
|     $agent_version | ||||
|   ) | ||||
|   $url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip" | ||||
|   Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\blackfire.zip >$null 2>&1 | ||||
|   7z e $php_dir\blackfire.zip -o"$php_dir" -y >$null 2>&1 | ||||
|   Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias blackfire $php_dir\blackfire.exe" | ||||
|   Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias blackfire-agent $php_dir\blackfire-agent.exe" | ||||
|   if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) { | ||||
|     blackfire-agent --register --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1 | ||||
|   } | ||||
|   if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) { | ||||
|     blackfire --config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1 | ||||
|   } | ||||
| } | ||||
|  | ||||
| # Variables | ||||
| $tick = ([char]8730) | ||||
| $cross = ([char]10007) | ||||
| @ -174,6 +195,7 @@ $ext_dir = $php_dir + '\ext' | ||||
| $ProgressPreference = 'SilentlyContinue' | ||||
| $master_version = '8.0' | ||||
| $arch = 'x64' | ||||
| $arch_name='amd64' | ||||
| $ts = $false | ||||
| if((Test-Path env:PHPTS) -and $env:PHPTS -eq 'ts') { | ||||
|   $ts = $true | ||||
| @ -197,6 +219,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version | ||||
|   if ($version -lt '7.0') { | ||||
|     Install-Module -Name VcRedist -Force | ||||
|     $arch='x86' | ||||
|     $arch_name='386' | ||||
|   } | ||||
|   if ($version -eq $master_version) { | ||||
|     $version = 'master' | ||||
| @ -205,7 +228,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version | ||||
|   Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1 | ||||
| } else { | ||||
|   if((Test-Path env:update) -and $env:update -eq 'true') { | ||||
|     Update-Php $php_dir > $null 2>&1 | ||||
|     Update-Php $php_dir >$null 2>&1 | ||||
|     $status = "Updated to" | ||||
|   } else { | ||||
|     $status = "Found" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur