Update README and licensing information

This commit is contained in:
Shivam Mathur 2020-07-20 11:50:58 +05:30
parent d2f865c91a
commit 25d9bbc737
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
5 changed files with 76 additions and 40 deletions

View File

@ -132,7 +132,7 @@ with:
extensions: xdebug-beta extensions: xdebug-beta
``` ```
- Non-default extensions can be removed by prefixing it with a `:`. - Shared extensions can be removed by prefixing them with a `:`.
```yaml ```yaml
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
@ -143,7 +143,7 @@ with:
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted. - Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
- These extensions have custom support - `gearman` on ubuntu, `blackfire`, `phalcon3` and `phalcon4` on all supported OS. - These extensions have custom support - `gearman` on `Ubuntu`, `blackfire`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
## :wrench: Tools Support ## :wrench: Tools Support
@ -178,13 +178,11 @@ with:
``` ```
**Notes** **Notes**
- Both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified. - Both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted. - Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
## :signal_strength: Coverage Support ## :signal_strength: Coverage Support
### Xdebug ### Xdebug
Specify `coverage: xdebug` to use `Xdebug`. Specify `coverage: xdebug` to use `Xdebug`.
@ -637,6 +635,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php"). - The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php").
- This project has multiple [dependencies](#bookmark-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories. - This project has multiple [dependencies](#bookmark-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
## :+1: Contributions ## :+1: Contributions
@ -649,10 +648,8 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
If this action helped you. If this action helped you.
- Sponsor the project by subscribing on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") or by contributing using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal"). - Sponsor the project by subscribing on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") or by contributing using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal"). This project is also available as part of the [Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-setup-php?utm_source=npm-setup-php&utm_medium=referral&utm_campaign=enterprise&utm_term=repo "Tidelift Subscription for setup-php") to support delivering enterprise-level maintenance.
- Please star the project and share it with the community. - Please star the project and dependencies. If you blog, please share your experience of using this action with the community.
- If you blog, write about your experience of using this action.
- If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
## :package: Dependencies ## :package: Dependencies

View File

@ -8,8 +8,14 @@ Param (
# Function to log result of a operation. # Function to log result of a operation.
Function Add-Log($mark, $subject, $message) { Function Add-Log($mark, $subject, $message) {
$code = if ($mark -eq $cross) { "31" } else { "32" } if ($mark -eq $tick) {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $code $mark $subject $message printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
Get-Content $ext_dir\ioncube\LICENSE.txt
Write-Output "::endgroup::"
} else {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
}
} }
$tick = ([char]8730) $tick = ([char]8730)
@ -36,7 +42,7 @@ try {
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
} }
"zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini "zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick "ioncube" $status Add-Log $tick "ioncube" $status
} catch { } catch {
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)" Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
} }

View File

@ -5,6 +5,9 @@ add_log() {
message=$3 message=$3
if [ "$mark" = "$tick" ]; then if [ "$mark" = "$tick" ]; then
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message" printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
cat /tmp/ioncube/LICENSE.txt
echo "::endgroup::"
else else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message" printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
fi fi
@ -18,7 +21,7 @@ check_extension() {
# Function to install ioncube. # Function to install ioncube.
install_ioncube() { install_ioncube() {
if [ ! -e $ext_dir/ioncube.so ]; then if [ ! -e "$ext_dir/ioncube.so" ]; then
os_name='lin' os_name='lin'
status='Installed and enabled' status='Installed and enabled'
[ "$(uname -s)" = "Darwin" ] && os_name='mac' [ "$(uname -s)" = "Darwin" ] && os_name='mac'

View File

@ -11,22 +11,43 @@ Param (
$version $version
) )
# Function to log result of a operation.
Function Add-Log($mark, $subject, $message) {
if ($mark -eq $tick) {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
printf "Oracle Instant Client package is required for %s extension.\n" $extension
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
Write-Output "::endgroup::"
} else {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
}
}
$tick = ([char]8730) $tick = ([char]8730)
$cross = ([char]10007)
$php_dir = 'C:\tools\php' $php_dir = 'C:\tools\php'
$status = 'Enabled'
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" } if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
$ext_dir = "$php_dir\ext" $ext_dir = "$php_dir\ext"
if(-not(Test-Path $php_dir\oci.dll)) { $installed = Get-Php -Path $php_dir
try
{
if (-not(Test-Path $php_dir\oci.dll)) {
$suffix = 'windows' $suffix = 'windows'
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') { if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0')
{
$suffix = 'nt' $suffix = 'nt'
} }
Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
Copy-Item $php_dir\instantclient*\* $php_dir Copy-Item $php_dir\instantclient*\* $php_dir
} }
if ($extension -eq "pdo_oci") { if ($extension -eq "pdo_oci") {
Enable-PhpExtension pdo_oci -Path $php_dir Enable-PhpExtension pdo_oci -Path $php_dir
} else { } else {
$status = 'Installed and enabled'
$ociVersion = '2.2.0' $ociVersion = '2.2.0'
if ($version -eq '7.0') if ($version -eq '7.0')
{ {
@ -36,10 +57,12 @@ if ($extension -eq "pdo_oci") {
{ {
$ociVersion = '2.0.12' $ociVersion = '2.0.12'
} }
$PhpVersion = Get-Php -Path $php_dir $ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $phpVersion
Invoke-WebRequest -UseBasicParsing -Uri $ociUrl -OutFile $php_dir\oci8.zip Invoke-WebRequest -UseBasicParsing -Uri $ociUrl -OutFile $php_dir\oci8.zip
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
}
Add-Log $tick $extension $status
} catch {
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
} }
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Enabled"

View File

@ -5,6 +5,11 @@ add_log() {
message=$3 message=$3
if [ "$mark" = "$tick" ]; then if [ "$mark" = "$tick" ]; then
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message" printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
echo "::endgroup::"
else else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message" printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
fi fi
@ -102,6 +107,7 @@ install_dependencies() {
install_extension() { install_extension() {
if ! [ -e "$ext_dir/$ext.so" ]; then if ! [ -e "$ext_dir/$ext.so" ]; then
( (
status='Installed and enabled'
phpize_orig=$(get_phpize) phpize_orig=$(get_phpize)
tag=$(get_tag) tag=$(get_tag)
get_php get_php
@ -121,6 +127,7 @@ ext=$1
version=$2 version=$2
tick='✓' tick='✓'
cross='✗' cross='✗'
status='Enabled'
oracle_home='/opt/oracle' oracle_home='/opt/oracle'
oracle_client=$oracle_home/instantclient oracle_client=$oracle_home/instantclient
runner="${runner:-github}" && RUNNER="${RUNNER:-github}" runner="${runner:-github}" && RUNNER="${RUNNER:-github}"
@ -130,4 +137,4 @@ ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
install_client >/dev/null 2>&1 install_client >/dev/null 2>&1
install_dependencies >/dev/null 2>&1 install_dependencies >/dev/null 2>&1
install_extension >/dev/null 2>&1 install_extension >/dev/null 2>&1
(check_extension "$ext" && add_log "$tick" "$ext" "Installed and enabled") || add_log "$cross" "$ext" "Could not install $ext" (check_extension "$ext" && add_log "$tick" "$ext" "$status") || add_log "$cross" "$ext" "Could not install $ext"