summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-03-16 09:23:03 +0100
committerRemi Collet <fedora@famillecollet.com>2015-03-16 09:23:03 +0100
commit7bcfaf8fd433cd7bdff0accaf186a038770c430e (patch)
treea669f04c81e66073c8c7c0a2af727bb92ae0d722
parenteddd8e5645c6e614b0a079a538ded82a767c327e (diff)
php-pecl-apm: upstream fix + updated config
-rw-r--r--APM-config.patch47
-rw-r--r--APM-upstream.patch101
-rw-r--r--REFLECTION12
-rw-r--r--php-pecl-apm.spec17
4 files changed, 166 insertions, 11 deletions
diff --git a/APM-config.patch b/APM-config.patch
new file mode 100644
index 0000000..94fe6bc
--- /dev/null
+++ b/APM-config.patch
@@ -0,0 +1,47 @@
+--- apm.ini.rpm 2015-03-16 09:05:02.000000000 +0100
++++ apm.ini 2015-03-16 09:07:05.000000000 +0100
+@@ -2,7 +2,7 @@
+
+ extension=apm.so
+ ; Whether the extension is globally active or not (overrides apm.event_enabled and apm.*_stats_enabled)
+-; apm.enabled="1"
++apm.enabled=Off
+ ; Application identifier, helps identifying which application is being monitored
+ ; apm.application_id="My application"
+ ; Enable the capture of events such as errors, notices, warnings,...
+@@ -26,7 +26,7 @@
+
+ ; SQLite configuration
+ ; Whether to enable the sqlite driver
+-; apm.sqlite_enabled=On
++apm.sqlite_enabled=Off
+ ; Whether to collect stats for the sqlite driver (ATTENTION: Has an impact on performance!)
+ ; apm.sqlite_stats_enabled=Off
+ ; Error reporting level specific to the sqlite driver
+@@ -46,7 +46,7 @@
+
+ ; MySQL configuration
+ ; Whether to enable the mysql driver
+-; apm.mysql_enabled=On
++apm.mysql_enabled=Off
+ ; Whether to collect stats for the mysql driver (ATTENTION: Has an impact on performance!)
+ ; apm.mysql_stats_enabled=Off
+ ; Error reporting level specific to the mysql driver
+@@ -68,7 +68,7 @@
+
+ ; StatsD configuration
+ ; Whether to enable the statsd driver
+-; apm.statsd_enabled=On
++apm.statsd_enabled=Off
+ ; Whether to collect stats for the StatsD driver
+ ; apm.statsd_stats_enabled=On
+ ; Host of the statsd server
+@@ -78,7 +78,7 @@
+
+ ; Socket configuration
+ ; Whether to enable the socket driver
+-; apm.socket_enabled=On
++apm.socket_enabled=Off
+ ; Whether to collect stats for the Socket driver
+ ; apm.socket_stats_enabled=On
+ ; Error reporting level specific to the socket driver
diff --git a/APM-upstream.patch b/APM-upstream.patch
new file mode 100644
index 0000000..5d30be7
--- /dev/null
+++ b/APM-upstream.patch
@@ -0,0 +1,101 @@
+From 922a92ba1f0fd0b771082b8d998003ebd60415e9 Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Tue, 10 Mar 2015 08:18:34 +0100
+Subject: [PATCH] fix version reported in reflection
+
+---
+ apm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/apm.c b/apm.c
+index 8fae308..b9ddb51 100644
+--- a/apm.c
++++ b/apm.c
+@@ -115,7 +115,7 @@ zend_module_entry apm_module_entry = {
+ PHP_RSHUTDOWN(apm),
+ PHP_MINFO(apm),
+ #if ZEND_MODULE_API_NO >= 20010901
+- "0.1.0",
++ PHP_APM_VERSION,
+ #endif
+ PHP_MODULE_GLOBALS(apm),
+ PHP_GINIT(apm),
+From c26e0d88df157f1ac5386c15036023f6954fd2c4 Mon Sep 17 00:00:00 2001
+From: Patrick Allaert <pa@ez.no>
+Date: Tue, 10 Mar 2015 16:33:31 +0100
+Subject: [PATCH] Fixed: global 'apm.enabled' switch not taken into account
+ everywhere (thx @remicollet)
+
+---
+ driver_socket.c | 2 +-
+ driver_sqlite3.c | 14 ++++++++------
+ driver_statsd.c | 8 ++++++++
+ 3 files changed, 17 insertions(+), 7 deletions(-)
+
+diff --git a/driver_socket.c b/driver_socket.c
+index 39daca5..40fcdd4 100644
+--- a/driver_socket.c
++++ b/driver_socket.c
+@@ -115,7 +115,7 @@ int apm_driver_socket_rshutdown(TSRMLS_D)
+ struct addrinfo hints, *servinfo;
+ char host[1024], *port;
+
+- if (!APM_G(socket_enabled)) {
++ if (!(APM_G(enabled) && APM_G(socket_enabled))) {
+ return SUCCESS;
+ }
+
+diff --git a/driver_sqlite3.c b/driver_sqlite3.c
+index 4b0c4ef..f9bbe10 100644
+--- a/driver_sqlite3.c
++++ b/driver_sqlite3.c
+@@ -74,15 +74,17 @@ static int perform_db_access_checks(const char *path TSRMLS_DC)
+
+ PHP_INI_MH(OnUpdateDBFile)
+ {
+- if (new_value && new_value_length > 0) {
+- snprintf(APM_G(sqlite3_db_file), MAXPATHLEN, "%s/%s", new_value, DB_FILE);
+- disconnect(TSRMLS_C);
++ if (APM_G(enabled) && APM_G(sqlite3_enabled)) {
++ if (new_value && new_value_length > 0) {
++ snprintf(APM_G(sqlite3_db_file), MAXPATHLEN, "%s/%s", new_value, DB_FILE);
++ disconnect(TSRMLS_C);
+
+- if (perform_db_access_checks(new_value TSRMLS_CC) == FAILURE) {
++ if (perform_db_access_checks(new_value TSRMLS_CC) == FAILURE) {
++ APM_G(sqlite3_enabled) = 0;
++ }
++ } else {
+ APM_G(sqlite3_enabled) = 0;
+ }
+- } else {
+- APM_G(sqlite3_enabled) = 0;
+ }
+ return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ }
+diff --git a/driver_statsd.c b/driver_statsd.c
+index a92c80a..4527d5e 100644
+--- a/driver_statsd.c
++++ b/driver_statsd.c
+@@ -110,6 +110,10 @@ int apm_driver_statsd_minit(int module_number TSRMLS_DC)
+ struct addrinfo hints;
+ char port[8];
+
++ if (!(APM_G(enabled) && APM_G(statsd_enabled))) {
++ return SUCCESS;
++ }
++
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_DGRAM;
+@@ -129,6 +133,10 @@ int apm_driver_statsd_rinit(TSRMLS_D)
+
+ int apm_driver_statsd_mshutdown(SHUTDOWN_FUNC_ARGS)
+ {
++ if (!(APM_G(enabled) && APM_G(statsd_enabled))) {
++ return SUCCESS;
++ }
++
+ freeaddrinfo(APM_G(statsd_servinfo));
+
+ return SUCCESS;
diff --git a/REFLECTION b/REFLECTION
index 95c2c2b..6f0f344 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,8 +1,8 @@
-Extension [ <persistent> extension #183 apm version 0.1.0 ] {
+Extension [ <persistent> extension #171 apm version 2.0.2 ] {
- INI {
Entry [ apm.enabled <ALL> ]
- Current = '1'
+ Current = ''
}
Entry [ apm.application_id <ALL> ]
Current = 'My application'
@@ -35,7 +35,7 @@ Extension [ <persistent> extension #183 apm version 0.1.0 ] {
Current = '4'
}
Entry [ apm.sqlite_enabled <PERDIR> ]
- Current = '1'
+ Current = ''
}
Entry [ apm.sqlite_stats_enabled <ALL> ]
Current = '0'
@@ -56,7 +56,7 @@ Extension [ <persistent> extension #183 apm version 0.1.0 ] {
Current = '1'
}
Entry [ apm.mysql_enabled <PERDIR> ]
- Current = '1'
+ Current = ''
}
Entry [ apm.mysql_stats_enabled <ALL> ]
Current = '0'
@@ -86,7 +86,7 @@ Extension [ <persistent> extension #183 apm version 0.1.0 ] {
Current = '1'
}
Entry [ apm.statsd_enabled <PERDIR> ]
- Current = '1'
+ Current = ''
}
Entry [ apm.statsd_stats_enabled <ALL> ]
Current = '1'
@@ -104,7 +104,7 @@ Extension [ <persistent> extension #183 apm version 0.1.0 ] {
Current = 'apm'
}
Entry [ apm.socket_enabled <ALL> ]
- Current = '1'
+ Current = ''
}
Entry [ apm.socket_stats_enabled <ALL> ]
Current = '1'
diff --git a/php-pecl-apm.spec b/php-pecl-apm.spec
index 6e4e24f..9f1695a 100644
--- a/php-pecl-apm.spec
+++ b/php-pecl-apm.spec
@@ -39,13 +39,18 @@
Name: %{?scl_prefix}php-pecl-apm
Summary: Alternative PHP Monitor
Version: 2.0.2
-Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
Source0: http://pecl.php.net/get/%{proj_name}-%{version}.tgz
# Webserver configuration files
Source1: %{pkg_name}.httpd
Source2: %{pkg_name}.nginx
+# Disable the extension and drivers by default
+Patch0: %{proj_name}-config.patch
+# Upstream patches
+Patch1: %{proj_name}-upstream.patch
+
License: PHP
Group: Development/Languages
URL: http://pecl.php.net/package/%{proj_name}
@@ -120,6 +125,8 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
mv %{proj_name}-%{version} NTS
cd NTS
+%patch0 -p0 -b .rpm
+%patch1 -p1 -b .upstream
: Sanity check, really often broken
extver=$(sed -n '/#define PHP_APM_VERSION/{s/.* "//;s/".*$//;p}' php_apm.h)
@@ -127,10 +134,6 @@ if test "x${extver}" != "x%{version}"; then
: Error: Upstream extension version is ${extver}, expecting %{version}.
exit 1
fi
-
-: Disable the ext
-sed -e 's/^extension=/; extension=/' \
- -i apm.ini
cd ..
%if %{with_zts}
@@ -249,6 +252,10 @@ fi
%changelog
+* Tue Mar 10 2015 Remi Collet <remi@fedoraproject.org> - 2.0.2-2
+- upstream patches
+- fix provided configuration
+
* Tue Mar 10 2015 Remi Collet <remi@fedoraproject.org> - 2.0.2-1
- Update to 2.0.2
- drop sub package, apm-web is now a separate project