@@ -167,6 +167,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_expunge, 0, 0, 1)
167
167
ZEND_ARG_INFO (0 , stream_id )
168
168
ZEND_END_ARG_INFO ()
169
169
170
+ ZEND_BEGIN_ARG_INFO_EX (arginfo_imap_gc , 0 , 0 , 1 )
171
+ ZEND_ARG_INFO (0 , stream_id )
172
+ ZEND_ARG_INFO (0 , flags )
173
+ ZEND_END_ARG_INFO ()
174
+
170
175
ZEND_BEGIN_ARG_INFO_EX (arginfo_imap_close , 0 , 0 , 1 )
171
176
ZEND_ARG_INFO (0 , stream_id )
172
177
ZEND_ARG_INFO (0 , options )
@@ -468,6 +473,7 @@ const zend_function_entry imap_functions[] = {
468
473
PHP_FE (imap_savebody , arginfo_imap_savebody )
469
474
PHP_FE (imap_fetchheader , arginfo_imap_fetchheader )
470
475
PHP_FE (imap_fetchstructure , arginfo_imap_fetchstructure )
476
+ PHP_FE (imap_gc , arginfo_imap_gc )
471
477
PHP_FE (imap_expunge , arginfo_imap_expunge )
472
478
PHP_FE (imap_delete , arginfo_imap_delete )
473
479
PHP_FE (imap_undelete , arginfo_imap_undelete )
@@ -1025,6 +1031,15 @@ PHP_MINIT_FUNCTION(imap)
1025
1031
ENCOTHER unknown
1026
1032
*/
1027
1033
1034
+ REGISTER_LONG_CONSTANT ("IMAP_GC_ELT" , GC_ELT , CONST_PERSISTENT | CONST_CS );
1035
+ REGISTER_LONG_CONSTANT ("IMAP_GC_ENV" , GC_ENV , CONST_PERSISTENT | CONST_CS );
1036
+ REGISTER_LONG_CONSTANT ("IMAP_GC_TEXTS" , GC_TEXTS , CONST_PERSISTENT | CONST_CS );
1037
+ /*
1038
+ GC_ELT message cache elements
1039
+ GC_ENV ENVELOPEs and BODYs
1040
+ GC_TEXTS texts
1041
+ */
1042
+
1028
1043
le_imap = zend_register_list_destructors_ex (mail_close_it , NULL , "imap" , module_number );
1029
1044
return SUCCESS ;
1030
1045
}
@@ -1472,6 +1487,31 @@ PHP_FUNCTION(imap_expunge)
1472
1487
}
1473
1488
/* }}} */
1474
1489
1490
+ /* {{{ proto bool imap_gc(resource stream_id, int flags)
1491
+ This function garbage collects (purges) the cache of entries of a specific type. */
1492
+ PHP_FUNCTION (imap_gc )
1493
+ {
1494
+ zval * streamind ;
1495
+ pils * imap_le_struct ;
1496
+ long flags ;
1497
+
1498
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "rl" , & streamind , & flags ) == FAILURE ) {
1499
+ return ;
1500
+ }
1501
+
1502
+ if (flags && ((flags & ~(GC_TEXTS | GC_ELT | GC_ENV )) != 0 )) {
1503
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "invalid value for the flags parameter" );
1504
+ RETURN_FALSE ;
1505
+ }
1506
+
1507
+ ZEND_FETCH_RESOURCE (imap_le_struct , pils * , & streamind , -1 , "imap" , le_imap );
1508
+
1509
+ mail_gc (imap_le_struct -> imap_stream , flags );
1510
+
1511
+ RETURN_TRUE ;
1512
+ }
1513
+ /* }}} */
1514
+
1475
1515
/* {{{ proto bool imap_close(resource stream_id [, int options])
1476
1516
Close an IMAP stream */
1477
1517
PHP_FUNCTION (imap_close )
0 commit comments