-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSystem.php
More file actions
executable file
·222 lines (211 loc) · 10.9 KB
/
System.php
File metadata and controls
executable file
·222 lines (211 loc) · 10.9 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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?php
namespace Foolz\FoolFrame\Model;
use Foolz\Plugin\Hook;
class System
{
public static function getEnvironment(Context $context)
{
$environment = [];
$environment['server'] = [
'title' => _i('Server Information'),
'data' => [
[
'title' => _i('Web Server Software'),
'value' => $_SERVER['SERVER_SOFTWARE'],
'alert' => [
'type' => 'warning',
'condition' => (bool) preg_match('/nginx/i', $_SERVER['SERVER_SOFTWARE']),
'title' => 'Warning',
'string' => _i('The nginx web server has its own internal file size limit variable for uploads. It is recommended that this value be set at the same value set in the PHP configuration file.')
]
],
[
'title' => _i('PHP Version'),
'value' => PHP_VERSION,
'alert' => [
'type' => 'important',
'condition' => (version_compare(PHP_VERSION, '5.4.0') < 0),
'title' => _i('Please Update Immediately'),
'string' => _i('The minimum requirements to run this software is 5.4.0.')
]
]
]
];
$environment['software'] = [
'title' => _i('Software Information'),
'data' => [
[
'title' => _i('FoolFrame Version'),
'value' => $context->getService('config')->get('foolz/foolframe', 'package', 'main.version'),
'alert' => [
'type' => 'info',
'condition' => true,
'title' => _i('New Update Available'),
'string' => _i('There is a new version of the software available for download.')
]
]
]
];
$environment['php-configuration'] = [
'title' => _i('PHP Configuration'),
'data' => [
[
'title' => _i('Config Location'),
'value' => php_ini_loaded_file(),
'description' => _i('This is the path to the location of the php.ini configuration file.')
],
[
'title' => 'allow_url_fopen',
'value' => (ini_get('allow_url_fopen') ? _i('On') : _i('Off')),
'description' => _i('This option enables the URL-aware fopen wrappers that allows access to remote files using the FTP or HTTP protocol.'),
'alert' => [
'type' => 'important',
'condition' => (bool) ! ini_get('allow_url_fopen'),
'title' => _i('Critical'),
'string' => _i('The PHP configuration on the server currently has URL-aware fopen wrappers disabled. The software will be operating at limited functionality.')
]
],
[
'title' => 'max_execution_time',
'value' => ini_get('max_execution_time'),
'description' => _i('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.'),
'alert' => [
'type' => 'warning',
'condition' => (bool) (intval(ini_get('max_execution_time')) < 60),
'title' => _i('Warning'),
'string' => _i('Your current value for maximum execution time is below the suggested value.')
]
],
[
'title' => 'file_uploads',
'value' => (ini_get('file_uploads') ? _i('On') : _i('Off')),
'description' => _i('This sets whether or not to allow HTTP file uploads.'),
'alert' => [
'type' => 'important',
'condition' => (bool) ! ini_get('file_uploads'),
'title' => _i('Critical'),
'string' => _i('The PHP configuration on the server currently has file uploads disabled. This option must be enabled for the software to fully function.')
]
],
[
'title' => 'post_max_size',
'value' => ini_get('post_max_size'),
'description' => _i('This sets the maximum size of POST data allowed.'),
'alert' => [
'type' => 'warning',
'condition' => (bool) (intval(substr(ini_get('post_max_size'), 0, -1)) < 16),
'title' => _i('Warning'),
'string' => _i('Your current value for maximum POST data size is below the suggested value.')
]
],
[
'title' => 'upload_max_filesize',
'value' => ini_get('upload_max_filesize'),
'description' => _i('This sets the maximum size allowed to be uploaded.'),
'alert' => [
'type' => 'warning',
'condition' => (bool) (intval(substr(ini_get('upload_max_filesize'), 0, -1)) < 16),
'title' => _i('Warning'),
'string' => _i('Your current value for maximum upload file size is below the suggested value.')
]
],
[
'title' => 'max_file_uploads',
'value' => ini_get('max_file_uploads'),
'description' => _i('This sets the maximum number of files allowed to be uploaded concurrently.'),
'alert' => [
'type' => 'warning',
'condition' => (bool) (intval(ini_get('max_file_uploads')) < 60),
'title' => _i('Warning'),
'string' => _i('Your current value for maximum number of concurrent uploads is below the suggested value.')
]
]
]
];
$environment['php-extensions'] = [
'title' => _i('PHP Extensions'),
'data' => [
[
'title' => 'APC',
'value' => (extension_loaded('apc') ? _i('Installed') : _i('Unavailable')),
'alert' => [
'type' => 'warning',
'condition' => (bool) ! extension_loaded('apc'),
'title' => _i('Warning'),
'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'APC' )
]
],
[
'title' => 'cURL',
'value' => (extension_loaded('curl') ? _i('Installed') : _i('Unavailable')),
'alert' => [
'type' => 'important',
'condition' => (bool) ! extension_loaded('curl'),
'title' => _i('Critical'),
'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'cURL')
]
],
[
'title' => 'FileInfo',
'value' => (extension_loaded('fileinfo') ? _i('Installed') : _i('Unavailable')),
'alert' => [
'type' => 'important',
'condition' => (bool) ! extension_loaded('fileinfo'),
'title' => _i('Critical'),
'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'FileInfo')
]
],
[
'title' => 'JSON',
'value' => (extension_loaded('json') ? _i('Installed') : _i('Unavailable')),
'alert' => [
'type' => 'important',
'condition' => (bool) ! extension_loaded('json'),
'title' => _i('Critical'),
'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'JSON')
]
],
[
'title' => 'Multi-byte String',
'value' => (extension_loaded('mbstring') ? _i('Installed') : _i('Unavailable')),
'alert' => [
'type' => 'important',
'condition' => (bool) ! extension_loaded('mbstring'),
'title' => _i('Critical'),
'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'Multi-byte String')
]
],
[
'title' => 'MySQLi',
'value' => (extension_loaded('mysqli') ? _i('Installed') : _i('Unavailable')),
'alert' => [
'type' => 'important',
'condition' => (bool) ! extension_loaded('mysqli'),
'title' => _i('Critical'),
'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'MySQLi')
]
],
[
'title' => 'PDO MySQL',
'value' => (extension_loaded('pdo_mysql') ? _i('Installed') : _i('Unavailable')),
'alert' => [
'type' => 'important',
'condition' => (bool) ! extension_loaded('pdo_mysql'),
'title' => _i('Critical'),
'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'PDO MySQL')
]
]
]
];
$environment = Hook::forge('Foolz\FoolFrame\Model\System::getEnvironment#var.environment')
->setParam('environment', $environment)
->execute()
->get($environment);
usort($environment['php-extensions']['data'], array('System', 'sortByTitle'));
return $environment;
}
public static function sortByTitle($a = [], $b = [])
{
return strcasecmp($a['title'], $b['title']);
}
}