Skip to content

Commit 7bdd6da

Browse files
authored
Merge pull request #2664 from cuchac/php_disconnect
PHP: Add support for uwsgi.disconnect() function
2 parents f41c7c3 + c1fdce1 commit 7bdd6da

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

plugins/php/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77

88
#include "ext/session/php_session.h"
99

10+
#include "ext/standard/head.h"
11+
1012
#include <uwsgi.h>
1113

plugins/php/php_plugin.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,21 @@ PHP_FUNCTION(uwsgi_signal) {
499499
RETURN_NULL();
500500
}
501501

502+
PHP_FUNCTION(uwsgi_disconnect) {
503+
504+
struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);
505+
506+
php_output_end_all();
507+
php_header();
508+
509+
uwsgi_disconnect(wsgi_req);
510+
511+
php_output_set_status(PHP_OUTPUT_DISABLED);
512+
513+
RETURN_NULL();
514+
}
515+
516+
502517
ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0)
503518
ZEND_END_ARG_INFO()
504519

@@ -517,6 +532,7 @@ zend_function_entry uwsgi_php_functions[] = {
517532
PHP_FE(uwsgi_cache_del, arginfo_void)
518533
PHP_FE(uwsgi_cache_clear, arginfo_void)
519534
PHP_FE(uwsgi_cache_exists, arginfo_void)
535+
PHP_FE(uwsgi_disconnect, arginfo_void)
520536
{ NULL, NULL, NULL},
521537
};
522538

0 commit comments

Comments
 (0)