-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.v
More file actions
64 lines (56 loc) · 1.79 KB
/
Copy pathhooks.v
File metadata and controls
64 lines (56 loc) · 1.79 KB
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
module vphp
import os
import vphp.zend
// 框架核心入口
@[export: 'vphp_framework_init']
pub fn vphp_framework_init(module_number int) {
// 自动初始化资源系统
init_framework(module_number)
}
pub fn init_framework(module_number int) {
zend.framework_init(module_number)
}
fn framework_debug_enabled() bool {
return os.getenv('VSLIM_CLI_DEBUG') != '' || os.getenv('VSLIM_CLI_DEBUG_FILE') != ''
}
fn framework_debug_log(message string) {
if !framework_debug_enabled() {
return
}
debug_file := os.getenv('VSLIM_CLI_DEBUG_FILE').trim_space()
if debug_file != '' {
line := '[vphp-framework-debug] ' + message + '\n'
mut file := os.open_file(debug_file, 'a') or {
mut created := os.create(debug_file) or { return }
created.write_string(line) or {}
created.close()
return
}
file.write_string(line) or {}
file.close()
return
}
eprintln('[vphp-framework-debug] ${message}')
}
@[export: 'vphp_framework_shutdown']
pub fn vphp_framework_shutdown() {
framework_debug_log('framework_shutdown enter')
framework_debug_log('framework_shutdown uninstall_runtime_hooks begin')
zend.uninstall_runtime_binding_hooks()
framework_debug_log('framework_shutdown uninstall_runtime_hooks done')
framework_debug_log('framework_shutdown autorelease_shutdown begin')
zend.autorelease_shutdown()
framework_debug_log('framework_shutdown autorelease_shutdown done')
framework_debug_log('framework_shutdown shutdown_registry begin')
zend.shutdown_registry()
framework_debug_log('framework_shutdown shutdown_registry done')
framework_debug_log('framework_shutdown exit')
}
@[export: 'vphp_framework_request_startup']
pub fn vphp_framework_request_startup() {
zend.request_startup()
}
@[export: 'vphp_framework_request_shutdown']
pub fn vphp_framework_request_shutdown() {
zend.request_shutdown()
}