mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 07:16:22 +07:00 
			
		
		
		
	Move blackfire setup to separate scripts
This commit is contained in:
		| @ -202,21 +202,6 @@ add_composertool() { | ||||
|   ) || add_log "$cross" "$tool" "Could not setup $tool" | ||||
| } | ||||
|  | ||||
| add_blackfire() { | ||||
|   sudo mkdir -p usr/local/var/run | ||||
|   brew tap --shallow blackfireio/homebrew-blackfire >/dev/null 2>&1 | ||||
|   brew install blackfire-agent >/dev/null 2>&1 | ||||
|   if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then | ||||
|     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 | ||||
|   fi | ||||
|   if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then | ||||
|     blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1 | ||||
|   fi | ||||
|   add_log "$tick" "blackfire" "Added" | ||||
|   add_log "$tick" "blackfire-agent" "Added" | ||||
| } | ||||
|  | ||||
| # Function to configure PECL | ||||
| configure_pecl() { | ||||
|   for tool in pear pecl; do | ||||
|  | ||||
| @ -305,24 +305,6 @@ add_devtools() { | ||||
|   configure_pecl >/dev/null 2>&1 | ||||
| } | ||||
|  | ||||
| # Function to add blackfire and blackfire-agent. | ||||
| add_blackfire() { | ||||
|   sudo mkdir -p /var/run/blackfire | ||||
|   sudo curl "${curl_opts[@]}" https://packages.blackfire.io/gpg.key | sudo apt-key add - >/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 | ||||
|   sudo "$debconf_fix" apt-get update >/dev/null 2>&1 | ||||
|   $apt_install blackfire-agent >/dev/null 2>&1 | ||||
|   if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then | ||||
|     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 | ||||
|   fi | ||||
|   if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then | ||||
|     blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1 | ||||
|   fi | ||||
|   add_log "$tick" "blackfire" "Added" | ||||
|   add_log "$tick" "blackfire-agent" "Added" | ||||
| } | ||||
|  | ||||
| # Function to setup the nightly build from master branch. | ||||
| setup_master() { | ||||
|   curl "${curl_opts[@]}" "$github"/php-builder/releases/latest/download/install.sh | bash -s "$runner" | ||||
|  | ||||
							
								
								
									
										17
									
								
								src/scripts/tools/blackfire.ps1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/scripts/tools/blackfire.ps1
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| # Function to add blackfire and blackfire-agent. | ||||
| Function Add-Blackfire() { | ||||
|   $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 | ||||
|   Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe" | ||||
|   Add-ToProfile $current_profile 'blackfire-agent' "New-Alias blackfire-agent $bin_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 | ||||
|   } | ||||
|   Add-Log $tick "blackfire" "Added" | ||||
|   Add-Log $tick "blackfire-agent" "Added" | ||||
| } | ||||
							
								
								
									
										34
									
								
								src/scripts/tools/blackfire.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/scripts/tools/blackfire.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| add_blackfire_linux() { | ||||
|   sudo mkdir -p /var/run/blackfire | ||||
|   sudo curl "${curl_opts[@]:?}" https://packages.blackfire.io/gpg.key | sudo apt-key add - | ||||
|   echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list | ||||
|   sudo "${debconf_fix:?}" apt-get update | ||||
|   ${apt_install:?} blackfire-agent | ||||
| } | ||||
|  | ||||
| add_blackfire_darwin() { | ||||
|   sudo mkdir -p /usr/local/var/run | ||||
|   brew tap --shallow blackfireio/homebrew-blackfire | ||||
|   brew install blackfire-agent | ||||
| } | ||||
|  | ||||
| blackfire_config() { | ||||
|   if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then | ||||
|     sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" | ||||
|     [ "$os" = "Linux" ] && sudo /etc/init.d/blackfire-agent restart | ||||
|     [ "$os" = "Darwin" ] && brew services start blackfire-agent | ||||
|   fi | ||||
|   if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then | ||||
|     blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" | ||||
|   fi | ||||
| } | ||||
|  | ||||
| # Function to add blackfire and blackfire-agent. | ||||
| add_blackfire() { | ||||
|   os="$(uname -s)" | ||||
|   [ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1 | ||||
|   [ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1 | ||||
|   blackfire_config >/dev/null 2>&1 | ||||
|   add_log "${tick:?}" "blackfire" "Added" | ||||
|   add_log "${tick:?}" "blackfire-agent" "Added" | ||||
| } | ||||
| @ -265,24 +265,6 @@ Function Add-Pecl() { | ||||
|   Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows" | ||||
| } | ||||
|  | ||||
| # Function to add blackfire and blackfire-agent. | ||||
| Function Add-Blackfire() { | ||||
|   $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 | ||||
|   Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe" | ||||
|   Add-ToProfile $current_profile 'blackfire-agent' "New-Alias blackfire-agent $bin_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 | ||||
|   } | ||||
|   Add-Log $tick "blackfire" "Added" | ||||
|   Add-Log $tick "blackfire-agent" "Added" | ||||
| } | ||||
|  | ||||
| # Variables | ||||
| $tick = ([char]8730) | ||||
| $cross = ([char]10007) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur