cvs: php-src(PHP_5_3) /ext/imap php_imap.c php_imap.h
| From: | Pierre-Alain Joye | Date: | Tue, 28 Apr 2009 08:22:57 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/imap php_imap.c php_imap.h | ||
| Groups: | php.cvs php.doc | ||
| Request: | Send a blank email to phpdoc+get-969380376@lists.php.net to get a copy of this message | ||
pajoye Tue Apr 28 08:22:57 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/imap php_imap.c php_imap.h
Log:
- [DOC] add imap_gc (purge cache(s) and constants IMAP_GC_ELT, IMAP_GC_ENV and IMAP_GC_TEXTS to
control imap_gc behavior
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.26.2.41&r2=1.208.2.7.2.26.2.42&diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.41
php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.42
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.41 Mon Apr 27 00:00:42 2009
+++ php-src/ext/imap/php_imap.c Tue Apr 28 08:22:56 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.208.2.7.2.26.2.41 2009/04/27 00:00:42 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.26.2.42 2009/04/28 08:22:56 pajoye Exp $ */
#define IMAP41
@@ -167,6 +167,11 @@
ZEND_ARG_INFO(0, stream_id)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_gc, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_close, 0, 0, 1)
ZEND_ARG_INFO(0, stream_id)
ZEND_ARG_INFO(0, options)
@@ -468,6 +473,7 @@
PHP_FE(imap_savebody, arginfo_imap_savebody)
PHP_FE(imap_fetchheader, arginfo_imap_fetchheader)
PHP_FE(imap_fetchstructure, arginfo_imap_fetchstructure)
+ PHP_FE(imap_gc, arginfo_imap_gc)
PHP_FE(imap_expunge, arginfo_imap_expunge)
PHP_FE(imap_delete, arginfo_imap_delete)
PHP_FE(imap_undelete, arginfo_imap_undelete)
@@ -1025,6 +1031,15 @@
ENCOTHER unknown
*/
+ REGISTER_LONG_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS);
+ /*
+ GC_ELT message cache elements
+ GC_ENV ENVELOPEs and BODYs
+ GC_TEXTS texts
+ */
+
le_imap = zend_register_list_destructors_ex(mail_close_it, NULL, "imap", module_number);
return SUCCESS;
}
@@ -1472,6 +1487,31 @@
}
/* }}} */
+/* {{{ proto bool imap_gc(resource stream_id, int flags)
+ This function garbage collects (purges) the cache of entries of a specific type. */
+PHP_FUNCTION(imap_gc)
+{
+ zval *streamind;
+ pils *imap_le_struct;
+ long flags;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &streamind, &flags)
== FAILURE) {
+ return;
+ }
+
+ if (flags && ((flags & ~(GC_TEXTS | GC_ELT | GC_ENV)) != 0)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid value for the flags parameter");
+ RETURN_FALSE;
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap);
+
+ mail_gc(imap_le_struct->imap_stream, flags);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
/* {{{ proto bool imap_close(resource stream_id [, int options])
Close an IMAP stream */
PHP_FUNCTION(imap_close)
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.h?r1=1.32.2.2.2.1.2.2&r2=1.32.2.2.2.1.2.3&diff_format=u
Index: php-src/ext/imap/php_imap.h
diff -u php-src/ext/imap/php_imap.h:1.32.2.2.2.1.2.2 php-src/ext/imap/php_imap.h:1.32.2.2.2.1.2.3
--- php-src/ext/imap/php_imap.h:1.32.2.2.2.1.2.2 Wed Dec 31 11:15:37 2008
+++ php-src/ext/imap/php_imap.h Tue Apr 28 08:22:57 2009
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.h,v 1.32.2.2.2.1.2.2 2008/12/31 11:15:37 sebastian Exp $ */
+/* $Id: php_imap.h,v 1.32.2.2.2.1.2.3 2009/04/28 08:22:57 pajoye Exp $ */
#ifndef PHP_IMAP_H
#define PHP_IMAP_H
@@ -115,6 +115,7 @@
PHP_FUNCTION(imap_fetchstructure);
PHP_FUNCTION(imap_fetchbody);
PHP_FUNCTION(imap_savebody);
+PHP_FUNCTION(imap_gc);
PHP_FUNCTION(imap_expunge);
PHP_FUNCTION(imap_delete);
PHP_FUNCTION(imap_undelete);