pajoye Tue Apr 28 08:23:32 2009 UTC Modified files: /php-src/ext/imap php_imap.c php_imap.h Log: - [DOC] MFB: 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.282&r2=1.283&diff_format=u Index: php-src/ext/imap/php_imap.c diff -u php-src/ext/imap/php_imap.c:1.282 php-src/ext/imap/php_imap.c:1.283 --- php-src/ext/imap/php_imap.c:1.282 Sun Apr 26 23:44:46 2009 +++ php-src/ext/imap/php_imap.c Tue Apr 28 08:23:32 2009 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski <z...@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.282 2009/04/26 23:44:46 pajoye Exp $ */ +/* $Id: php_imap.c,v 1.283 2009/04/28 08:23:32 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; } @@ -1468,6 +1483,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.38&r2=1.39&diff_format=u Index: php-src/ext/imap/php_imap.h diff -u php-src/ext/imap/php_imap.h:1.38 php-src/ext/imap/php_imap.h:1.39 --- php-src/ext/imap/php_imap.h:1.38 Tue Mar 10 23:39:22 2009 +++ php-src/ext/imap/php_imap.h Tue Apr 28 08:23:32 2009 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_imap.h,v 1.38 2009/03/10 23:39:22 helly Exp $ */ +/* $Id: php_imap.h,v 1.39 2009/04/28 08:23:32 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);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php