pecl-apc: dämliche warnings ausschalten
Hanno Böck

Hanno Böck commited on 2011-04-06 19:54:15
Zeige 3 geänderte Dateien mit 163 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,3 @@
1
+AUX pecl-apc-3.0.17-fix-useless-warnings.diff 4325 RMD160 9eaee3a7fdcf6e199a45993da087710cecf0f4b1 SHA1 ddb66d3806e8dbe80a897b77989ac3389cbe0ef6 SHA256 478e9f6483915351af78c11fac8b0805450f09cca00f51de2e4b05a1b6f986b0
2
+DIST APC-3.1.7.tgz 152735 RMD160 523c3b6aec6b712a89e36243cb7bf2a3297ae7ac SHA1 fd30aa79c7632f3da90193376a91152d157fa91f SHA256 9a526bdaa51ec8e84c2413e0f9c15099b951c39c995439ff2f54a3340a879b76
3
+EBUILD pecl-apc-3.1.7.ebuild 2639 RMD160 71159ce864b869bad95bb6ad99ce888d4b34c6de SHA1 11e2a495df57b0956925cd67124e453e2632d10c SHA256 9c8fccb3c9a2b312b989ccc57f6bb2c129854cc2c82028024659523258c40748
... ...
@@ -0,0 +1,86 @@
1
+diff -Naur APC-3.1.7/apc_bin.c APC-3.1.7-1//apc_bin.c
2
+--- APC-3.1.7/apc_bin.c	2011-01-11 20:06:38.000000000 +0100
3
++++ APC-3.1.7-1//apc_bin.c	2011-04-06 19:28:51.048623272 +0200
4
+@@ -703,7 +703,7 @@
5
+     apc_bd_alloc_ex(pool_ptr, sizeof(apc_pool) TSRMLS_CC);
6
+     ctxt.pool = apc_pool_create(APC_UNPOOL, apc_bd_alloc, apc_bd_free, NULL, NULL TSRMLS_CC);  /* ideally the pool wouldn't be alloc'd as part of this */
7
+     if (!ctxt.pool) { /* TODO need to cleanup */
8
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
9
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
10
+         return NULL;
11
+     }
12
+     ctxt.copy = APC_COPY_IN_USER;  /* avoid stupid ALLOC_ZVAL calls here, hack */
13
+@@ -854,7 +854,7 @@
14
+     for(i = 0; i < bd->num_entries; i++) {
15
+         ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
16
+         if (!ctxt.pool) { /* TODO need to cleanup previous pools */
17
+-            apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
18
++            php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
19
+             goto failure;
20
+         }
21
+         ep = &bd->entries[i];
22
+diff -Naur APC-3.1.7/apc_cache.c APC-3.1.7-1//apc_cache.c
23
+--- APC-3.1.7/apc_cache.c	2011-01-11 20:06:38.000000000 +0100
24
++++ APC-3.1.7-1//apc_cache.c	2011-04-06 19:29:39.271030454 +0200
25
+@@ -1270,6 +1270,7 @@
26
+ /* {{{ apc_cache_is_last_key */
27
+ zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, unsigned int h, time_t t TSRMLS_DC)
28
+ {
29
++    char *log_message;
30
+     apc_keyid_t *lastkey = &cache->header->lastkey;
31
+     unsigned int keylen = key->data.user.identifier_len;
32
+ #ifdef ZTS
33
+@@ -1288,7 +1289,10 @@
34
+         if(lastkey->mtime == t && FROM_DIFFERENT_THREAD(lastkey)) {
35
+             /* potential cache slam */
36
+             if(APCG(slam_defense)) {
37
+-                apc_warning("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier);
38
++                log_message = emalloc((key->data.user.identifier_len + 40) * sizeof(char));
39
++                sprintf(log_message, "Potential cache slam averted for key '%s'", key->data.user.identifier);
40
++                php_log_err(log_message TSRMLS_CC);
41
++                efree(log_message);
42
+                 return 1;
43
+             }
44
+         }
45
+diff -Naur APC-3.1.7/apc_main.c APC-3.1.7-1//apc_main.c
46
+--- APC-3.1.7/apc_main.c	2011-01-11 20:06:38.000000000 +0100
47
++++ APC-3.1.7-1//apc_main.c	2011-04-06 19:28:51.049623231 +0200
48
+@@ -414,7 +414,7 @@
49
+     ctxt.pool = apc_pool_create(APC_MEDIUM_POOL, apc_sma_malloc, apc_sma_free, 
50
+                                                  apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
51
+     if (!ctxt.pool) {
52
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
53
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
54
+         return FAILURE;
55
+     }
56
+     ctxt.copy = APC_COPY_IN_OPCODE;
57
+@@ -539,7 +539,7 @@
58
+         ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free,
59
+                                                 apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
60
+         if (!ctxt.pool) {
61
+-            apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
62
++            php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
63
+             return old_compile_file(h, type TSRMLS_CC);
64
+         }
65
+         ctxt.copy = APC_COPY_OUT_OPCODE;
66
+diff -Naur APC-3.1.7/php_apc.c APC-3.1.7-1//php_apc.c
67
+--- APC-3.1.7/php_apc.c	2011-01-11 20:06:38.000000000 +0100
68
++++ APC-3.1.7-1//php_apc.c	2011-04-06 19:28:51.049623231 +0200
69
+@@ -578,7 +578,7 @@
70
+ 
71
+     ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
72
+     if (!ctxt.pool) {
73
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
74
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
75
+         return 0;
76
+     }
77
+     ctxt.copy = APC_COPY_IN_USER;
78
+@@ -819,7 +819,7 @@
79
+ 
80
+     ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, NULL, NULL TSRMLS_CC);
81
+     if (!ctxt.pool) {
82
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
83
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
84
+         RETURN_FALSE;
85
+     }
86
+     ctxt.copy = APC_COPY_OUT_USER;
... ...
@@ -0,0 +1,74 @@
1
+# Copyright 1999-2011 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/dev-php5/pecl-apc/pecl-apc-3.1.7.ebuild,v 1.5 2011/03/24 17:49:38 xarthisius Exp $
4
+
5
+EAPI=2
6
+
7
+PHP_EXT_NAME="apc"
8
+PHP_EXT_PECL_PKG="APC"
9
+PHP_EXT_INI="yes"
10
+PHP_EXT_ZENDEXT="no"
11
+DOCS="CHANGELOG INSTALL NOTICE TECHNOTES.txt TODO"
12
+
13
+inherit php-ext-pecl-r2 confutils eutils
14
+
15
+KEYWORDS="amd64 ppc ppc64 x86"
16
+
17
+DESCRIPTION="A free, open, and robust framework for caching and optimizing PHP code."
18
+LICENSE="PHP-3.01"
19
+SLOT="0"
20
+IUSE="mmap"
21
+
22
+DEPEND="!dev-php/eaccelerator !dev-php5/xcache"
23
+RDEPEND="${DEPEND}"
24
+
25
+src_prepare() {
26
+	epatch "${FILESDIR}"/pecl-apc-3.0.17-fix-useless-warnings.diff
27
+	php-ext-source-r2_src_prepare
28
+}
29
+
30
+src_configure() {
31
+	my_conf="--enable-apc"
32
+	enable_extension_enable "apc-mmap" "mmap" 0
33
+
34
+	php-ext-source-r2_src_configure
35
+}
36
+
37
+src_install() {
38
+	php-ext-pecl-r2_src_install
39
+
40
+	php-ext-source-r2_addtoinifiles "apc.enabled" '"1"'
41
+	php-ext-source-r2_addtoinifiles "apc.shm_segments" '"1"'
42
+	php-ext-source-r2_addtoinifiles "apc.shm_size" '"30M"'
43
+	php-ext-source-r2_addtoinifiles "apc.num_files_hint" '"1024"'
44
+	php-ext-source-r2_addtoinifiles "apc.ttl" '"7200"'
45
+	php-ext-source-r2_addtoinifiles "apc.user_ttl" '"7200"'
46
+	php-ext-source-r2_addtoinifiles "apc.gc_ttl" '"3600"'
47
+	php-ext-source-r2_addtoinifiles "apc.cache_by_default" '"1"'
48
+	php-ext-source-r2_addtoinifiles ";apc.filters" '""'
49
+	php-ext-source-r2_addtoinifiles ";apc.mmap_file_mask" '"/tmp/apcphp5.XXXXXX"'
50
+	php-ext-source-r2_addtoinifiles "apc.slam_defense" '"0"'
51
+	php-ext-source-r2_addtoinifiles "apc.file_update_protection" '"2"'
52
+	php-ext-source-r2_addtoinifiles "apc.enable_cli" '"0"'
53
+	php-ext-source-r2_addtoinifiles "apc.max_file_size" '"1M"'
54
+	php-ext-source-r2_addtoinifiles "apc.stat" '"1"'
55
+	php-ext-source-r2_addtoinifiles "apc.write_lock" '"1"'
56
+	php-ext-source-r2_addtoinifiles "apc.report_autofilter" '"0"'
57
+	php-ext-source-r2_addtoinifiles "apc.include_once_override" '"0"'
58
+	php-ext-source-r2_addtoinifiles "apc.rfc1867" '"0"'
59
+	php-ext-source-r2_addtoinifiles "apc.rfc1867_prefix" '"upload_"'
60
+	php-ext-source-r2_addtoinifiles "apc.rfc1867_name" '"APC_UPLOAD_PROGRESS"'
61
+	php-ext-source-r2_addtoinifiles "apc.rfc1867_freq" '"0"'
62
+	php-ext-source-r2_addtoinifiles "apc.localcache" '"0"'
63
+	php-ext-source-r2_addtoinifiles "apc.localcache.size" '"512"'
64
+	php-ext-source-r2_addtoinifiles "apc.coredump_unmap" '"0"'
65
+
66
+	dodir "${PHP_EXT_SHARED_DIR}"
67
+	insinto "${PHP_EXT_SHARED_DIR}"
68
+	doins apc.php
69
+}
70
+
71
+pkg_postinst() {
72
+	elog "The apc.php file shipped with this release of PECL-APC was"
73
+	elog "installed into ${PHP_EXT_SHARED_DIR}/apc/."
74
+}
0 75