Add support for newrelic (#910)

pull/911/head
Michele Locati 2024-04-16 10:52:52 +02:00 committed by GitHub
parent 9eb0c12a9c
commit b899180851
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 51 additions and 2 deletions

View File

@ -417,6 +417,7 @@ Here's the list of all the supported environment variables:
| http, intl, mongodb | `IPE_ICU_EN_ONLY=1` | Some extensions require the ICU library, use this flag to install a smaller, but English-only, ICU library on Alpine 3.16 and later | | http, intl, mongodb | `IPE_ICU_EN_ONLY=1` | Some extensions require the ICU library, use this flag to install a smaller, but English-only, ICU library on Alpine 3.16 and later |
| pspell | `IPE_ASPELL_LANGUAGES='...'` | Configure the languages to be made available (for example: `IPE_ASPELL_LANGUAGES='en fr'`). If omitted, we'll assume `en` | | pspell | `IPE_ASPELL_LANGUAGES='...'` | Configure the languages to be made available (for example: `IPE_ASPELL_LANGUAGES='en fr'`). If omitted, we'll assume `en` |
| | `IPE_DEB_ARCHIVE` & `IPE_DEB_ARCHIVE_SECURITY` | The APT packages of very old Debian versions (eg Jessie) may have been archived: you can use these environment variables to specify custom URLs of these APT archives | | | `IPE_DEB_ARCHIVE` & `IPE_DEB_ARCHIVE_SECURITY` | The APT packages of very old Debian versions (eg Jessie) may have been archived: you can use these environment variables to specify custom URLs of these APT archives |
| newrelic | `NR_INSTALL_KEY` | Your New Relic license key |
## Special requirements ## Special requirements

View File

@ -61,6 +61,7 @@ msgpack 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
mssql 5.5 5.6 mssql 5.5 5.6
mysql 5.5 5.6 mysql 5.5 5.6
mysqli 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 mysqli 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
newrelic 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
oauth 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 oauth 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
oci8 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 oci8 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
odbc 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 odbc 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3

View File

@ -2364,6 +2364,32 @@ installCargo() {
fi fi
} }
installNewRelic() {
printf '# Installing newrelic\n'
installNewRelic_search='\bnewrelic-php[0-9.]*-[0-9]+(\.[0-9]+)*-linux'
case "$DISTRO" in
alpine)
installNewRelic_search="$installNewRelic_search-musl"
;;
esac
installNewRelic_file="$(curl -sSLf -o- https://download.newrelic.com/php_agent/release/ | sed -E 's/<[^>]*>//g' | grep -Eo "$installNewRelic_search.tar.gz" | sort | head -1)"
installNewRelic_url="https://download.newrelic.com/php_agent/release/$installNewRelic_file"
installNewRelic_src="$(getPackageSource "$installNewRelic_url")"
cd -- "$installNewRelic_src"
NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 ./newrelic-install install
cd - >/dev/null
cat <<EOT
NewRelic has been installed from $installNewRelic_url
You may need to:
- change the owner/permissions of /var/log/newrelic
(for example: chown -R www-data:www-data /var/log/newrelic)
- set the value of the newrelic.license configuration key in
$PHP_INI_DIR/conf.d/newrelic.ini
(if you didn't set the NR_INSTALL_KEY environment variable)
EOT
}
# Install a bundled PHP module given its handle # Install a bundled PHP module given its handle
# #
# Arguments: # Arguments:
@ -3206,6 +3232,10 @@ installRemoteModule() {
fi fi
fi fi
;; ;;
newrelic)
installNewRelic
installRemoteModule_manuallyInstalled=2
;;
oauth) oauth)
if test -z "$installRemoteModule_version"; then if test -z "$installRemoteModule_version"; then
if test $PHP_MAJMIN_VERSION -le 506; then if test $PHP_MAJMIN_VERSION -le 506; then
@ -4190,8 +4220,10 @@ installRemoteModule() {
installPeclPackage "$installRemoteModule_module" "$installRemoteModule_version" "$installRemoteModule_cppflags" "$installRemoteModule_path" installPeclPackage "$installRemoteModule_module" "$installRemoteModule_version" "$installRemoteModule_cppflags" "$installRemoteModule_path"
fi fi
postProcessModule "$installRemoteModule_module" postProcessModule "$installRemoteModule_module"
checkModuleWorking "$installRemoteModule_module" "$installRemoteModule_ini_basename" "$installRemoteModule_ini_extra" if test $installRemoteModule_manuallyInstalled -lt 2; then
enablePhpExtension "$installRemoteModule_module" "$installRemoteModule_ini_basename" "$installRemoteModule_ini_extra" checkModuleWorking "$installRemoteModule_module" "$installRemoteModule_ini_basename" "$installRemoteModule_ini_extra"
enablePhpExtension "$installRemoteModule_module" "$installRemoteModule_ini_basename" "$installRemoteModule_ini_extra"
fi
} }
# Check if a module/helper may be installed using the pecl archive # Check if a module/helper may be installed using the pecl archive

15
scripts/tests/newrelic Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/_bootstrap.php';
$rc = 0;
echo 'Checking if newrelic_start_transaction() exists... ';
if (!function_exists('newrelic_start_transaction')) {
$rc = 1;
echo "NO!\n";
} else {
echo "yes.\n";
}
exit($rc);