-
Notifications
You must be signed in to change notification settings - Fork 0
/
wanda.cc
103 lines (89 loc) · 2.1 KB
/
wanda.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* wanda extension for PHP */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "php_wanda.h"
#include "WandaHook.h"
/* For compatibility with older PHP versions */
#ifndef ZEND_PARSE_PARAMETERS_NONE
#define ZEND_PARSE_PARAMETERS_NONE() \
ZEND_PARSE_PARAMETERS_START(0, 0) \
ZEND_PARSE_PARAMETERS_END()
#endif
ZEND_DECLARE_MODULE_GLOBALS(wanda)
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(wanda)
{
#if defined(ZTS) && defined(COMPILE_DL_WANDA)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
if (strcasecmp("cli", sapi_module.name) != 0) {
WANDA_G(wanda)->startFpmMode();
WANDA_G(wanda)->executor();
}
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(wanda)
{
php_info_print_table_start();
php_info_print_table_header(2, "wanda support", "enabled");
php_info_print_table_end();
}
/* }}} */
/* {{{ wanda_functions[]
*/
static const zend_function_entry wanda_functions[] = {
PHP_FE_END
};
PHP_GINIT_FUNCTION(wanda)
{
wanda_globals->wanda = std::make_shared<Wanda::ZendWanda>();
wanda_globals->util = std::make_shared<Wanda::WandaUtil>();
}
//
PHP_GSHUTDOWN_FUNCTION(wanda)
{
wanda_globals->wanda.reset();
wanda_globals->util.reset();
}
PHP_MINIT_FUNCTION(wanda)
{
load_wanda_hook();
if (strcasecmp("cli", sapi_module.name) == 0) {
WANDA_G(wanda)->executor();
}
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(wanda)
{
return SUCCESS;
}
/* {{{ wanda_module_entry
*/
zend_module_entry wanda_module_entry = {
STANDARD_MODULE_HEADER,
"wanda", /* Extension name */
wanda_functions, /* zend_function_entry */
PHP_MINIT(wanda),
PHP_MSHUTDOWN(wanda), /* PHP_MSHUTDOWN - Module shutdown */
PHP_RINIT(wanda), /* PHP_RINIT - Request initialization */
NULL, /* PHP_RSHUTDOWN - Request shutdown */
PHP_MINFO(wanda), /* PHP_MINFO - Module info */
PHP_WANDA_VERSION, /* Version */
PHP_MODULE_GLOBALS(wanda),
PHP_GINIT(wanda),
PHP_GSHUTDOWN(wanda),
NULL,
STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
#ifdef COMPILE_DL_WANDA
# ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
# endif
ZEND_GET_MODULE(wanda)
#endif