-
Notifications
You must be signed in to change notification settings - Fork 12
/
speed.c
167 lines (144 loc) · 4.42 KB
/
speed.c
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
+----------------------------------------------------------------------+
| Speed framework |
+----------------------------------------------------------------------+
| Copyright (c) 2017-2020 www.supjos.cn |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Josin <[email protected]|www.supjos.cn> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_speed.h"
#include "kernel/net/supjos_speed_request.h"
#include "ext/pdo/php_pdo.h"
#include "ext/pdo/php_pdo_driver.h"
#include "zend_smart_str.h" /* use the smart_str */
/* True global resources - no need for thread safety here */
static int le_speed;
/* {{{ proto string speed_say_hi()
Printf a string to the output client. */
PHP_FUNCTION(speed_say_hi)
{
/* char *cwd = VCWD_GETCWD(NULL, 0);
zend_printf("Current Directory: %s", cwd);*/
zend_file_handle include_file_handle;
include_file_handle.handle.fp = NULL;
include_file_handle.filename = "Test.php";
include_file_handle.opened_path = NULL;
include_file_handle.type = ZEND_HANDLE_FILENAME;
include_file_handle.free_filename = 0;
zend_op_array *op_array;
op_array = zend_compile_file(&include_file_handle, ZEND_REQUIRE);
zend_execute_data *require = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_CODE | ZEND_CALL_HAS_SYMBOL_TABLE, (zend_function *)op_array, 0, NULL, NULL);
zval result;
ZVAL_UNDEF(&result);
zend_init_execute_data(require, op_array, &result);
ZEND_ADD_CALL_FLAG(require, ZEND_CALL_TOP);
zend_execute_ex(require);
zend_vm_stack_free_call_frame(require);
/*zend_printf("CSpeed %s", PHP_SPEED_VERSION);*/
RETURN_NULL()
}
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(speed)
{
/* Start the following module before Apache or Nginx loading the speed PHP extension */
SPEED_STARTUP(app);
SPEED_STARTUP(request);
SPEED_STARTUP(response);
SPEED_STARTUP(model);
SPEED_STARTUP(mysql);
SPEED_STARTUP(view);
SPEED_STARTUP(controller);
SPEED_STARTUP(callback);
SPEED_STARTUP(di);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(speed)
{
return SUCCESS;
}
/* }}} */
/* Remove if there's nothing to do at request start */
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(speed)
{
#if defined(COMPILE_DL_SPEED) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
/* Remove if there's nothing to do at request end */
/* {{{ PHP_RSHUTDOWN_FUNCTION
*/
PHP_RSHUTDOWN_FUNCTION(speed)
{
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(speed)
{
php_info_print_table_start();
php_info_print_table_header(2, "speed support", "enabled");
php_info_print_table_end();
}
/* }}} */
/* {{{ speed_functions[]
*/
const zend_function_entry speed_functions[] = {
PHP_FE(speed_say_hi, NULL)
PHP_FE_END
};
/* }}} */
/* {{{ speed_module_entry
*/
zend_module_entry speed_module_entry = {
STANDARD_MODULE_HEADER,
"speed",
speed_functions,
PHP_MINIT(speed),
PHP_MSHUTDOWN(speed),
PHP_RINIT(speed), /* Replace with NULL if there's nothing to do at request start */
PHP_RSHUTDOWN(speed), /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(speed),
PHP_SPEED_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_SPEED
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(speed)
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/