self_test.php
14.1 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<?php
namespace W3TC;
if ( !defined( 'W3TC' ) )
die();
?>
<h3><?php _e( 'Compatibility Check', 'w3-total-cache' ); ?></h3>
<fieldset>
<legend><?php _e( 'Legend', 'w3-total-cache' ); ?></legend>
<p>
<?php _e( '<code>Installed</code>: Functionality will work properly.', 'w3-total-cache' ); ?><br />
<?php _e( '<code>Not detected</code>: May be installed, but cannot be automatically confirmed.', 'w3-total-cache' ); ?><br />
<?php _e( '<code>Ok</code>: Current value is acceptable.', 'w3-total-cache' ); ?><br />
<?php _e( '<code>Yes / No</code>: The value was successful detected.', 'w3-total-cache' ); ?>
</p>
</fieldset>
<div id="w3tc-self-test">
<h4 style="margin-top: 0;"><?php _e( 'Server Modules & Resources:', 'w3-total-cache' ); ?></h4>
<ul>
<li>
<?php _e( 'Plugin Version:', 'w3-total-cache' ); ?> <code><?php echo W3TC_VERSION; ?></code>
</li>
<li>
<?php _e( 'PHP Version:', 'w3-total-cache' ); ?>
<code><?php echo PHP_VERSION; ?></code>;
</li>
<li>
Web Server:
<?php if ( stristr( $_SERVER['SERVER_SOFTWARE'], 'apache' ) !== false ): ?>
<code>Apache</code>
<?php elseif ( stristr( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false ): ?>
<code>Lite Speed</code>
<?php elseif ( stristr( $_SERVER['SERVER_SOFTWARE'], 'nginx' ) !== false ): ?>
<code>nginx</code>
<?php elseif ( stristr( $_SERVER['SERVER_SOFTWARE'], 'lighttpd' ) !== false ): ?>
<code>lighttpd</code>
<?php elseif ( stristr( $_SERVER['SERVER_SOFTWARE'], 'iis' ) !== false ): ?>
<code>Microsoft IIS</code>
<?php else: ?>
<code>Not detected</code>
<?php endif; ?>
</li>
<li>
FTP functions:
<?php if ( function_exists( 'ftp_connect' ) ): ?>
<code>Installed</code>
<?php else: ?>
<code>Not installed</code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for Self-hosted (<acronym title="File Transfer Protocol">FTP</acronym>) <acronym title="Content Delivery Network">CDN</acronym> support)', 'w3-total-cache' ); ?></span>
</li>
<li>
<?php _e( 'Multibyte String support:', 'w3-total-cache' ); ?>
<?php if ( function_exists( 'mb_substr' ) ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for Rackspace Cloud Files support)', 'w3-total-cache' ); ?></span>
</li>
<li>
<?php _e( 'cURL extension:', 'w3-total-cache' ); ?>
<?php if ( function_exists( 'curl_init' ) ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for Amazon S3, Amazon CloudFront, Rackspace CloudFiles support)', 'w3-total-cache' ); ?></span>
</li>
<li>
zlib extension:
<?php if ( function_exists( 'gzencode' ) ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for compression support)', 'w3-total-cache' ); ?></span>
</li>
<li>
Opcode cache:
<?php if ( Util_Installed::opcache() ): ?>
<code><?php _e( 'Installed (OPCache)', 'w3-total-cache' ); ?></code>
<?php elseif ( Util_Installed::apc() ): ?>
<code><?php _e( 'Installed (APC)', 'w3-total-cache' ); ?></code>
<?php elseif ( Util_Installed::eaccelerator() ): ?>
<code><?php _e( 'Installed (eAccelerator)', 'w3-total-cache' ); ?></code>
<?php elseif ( Util_Installed::xcache() ): ?>
<code><?php _e( 'Installed (XCache)', 'w3-total-cache' ); ?></code>
<?php elseif ( PHP_VERSION >= 6 ): ?>
<code><?php _e( 'PHP6', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'Memcached extension:', 'w3-total-cache' ); ?>
<?php if ( class_exists( '\Memcached' ) ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'Memcache extension:', 'w3-total-cache' ); ?>
<?php if ( class_exists( '\Memcache' ) ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'Redis extension:', 'w3-total-cache' ); ?>
<?php if ( Util_Installed::redis() ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'HTML Tidy extension:', 'w3-total-cache' ); ?>
<?php if ( Util_Installed::tidy() ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for HTML Tidy minifier suppport)', 'w3-total-cache' ); ?></span>
</li>
<li>
<?php _e( 'Mime type detection:', 'w3-total-cache' ); ?>
<?php if ( function_exists( 'finfo_open' ) ): ?>
<code><?php _e( 'Installed (Fileinfo)', 'w3-total-cache' ); ?></code>
<?php elseif ( function_exists( 'mime_content_type' ) ): ?>
<code><?php _e( 'Installed (mime_content_type)', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for <acronym title="Content Delivery Network">CDN</acronym> support)', 'w3-total-cache' ); ?></span>
</li>
<li>
<?php _e( 'Hash function:', 'w3-total-cache' ); ?>
<?php if ( function_exists( 'hash' ) ): ?>
<code><?php _e( 'Installed (hash)', 'w3-total-cache' ); ?></code>
<?php elseif ( function_exists( 'mhash' ) ): ?>
<code><?php _e( 'Installed (mhash)', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for NetDNA / MaxCDN <acronym title="Content Delivery Network">CDN</acronym> purge support)', 'w3-total-cache' ); ?></span>
</li>
<li>
<?php _e( 'Safe mode:', 'w3-total-cache' ); ?>
<?php if ( Util_Environment::to_boolean( ini_get( 'safe_mode' ) ) ): ?>
<code><?php _e( 'On', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Off', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'Open basedir:', 'w3-total-cache' ); ?>
<?php $open_basedir = ini_get( 'open_basedir' ); if ( $open_basedir ): ?>
<code><?php _e( 'On:', 'w3-total-cache' ); ?> <?php echo htmlspecialchars( $open_basedir ); ?></code>
<?php else: ?>
<code><?php _e( 'Off', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'zlib output compression:', 'w3-total-cache' ); ?>
<?php if ( Util_Environment::to_boolean( ini_get( 'zlib.output_compression' ) ) ): ?>
<code><?php _e( 'On', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Off', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'set_time_limit:', 'w3-total-cache' ); ?>
<?php if ( function_exists( 'set_time_limit' ) ): ?>
<code><?php _e( 'Available', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not available', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<?php
if ( Util_Environment::is_apache() ):
$apache_modules = ( function_exists( 'apache_get_modules' ) ? apache_get_modules() : false );
$modules = array(
'mod_deflate',
'mod_env',
'mod_expires',
'mod_filter',
'mod_ext_filter',
'mod_headers',
'mod_mime',
'mod_rewrite',
'mod_setenvif'
);
?>
<?php foreach ( $modules as $module ): ?>
<li>
<?php echo $module; ?>:
<?php if ( $apache_modules ): ?>
<?php if ( in_array( $module, $apache_modules ) ): ?>
<code><?php _e( 'Installed', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not installed', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<?php else: ?>
<code><?php _e( 'Not detected', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<span class="w3tc-self-test-hint"><?php _e( '(required for disk enhanced Page Cache and Browser Cache)', 'w3-total-cache' ); ?></span>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
<?php $additional_checks = apply_filters( 'w3tc_compatibility_test', __return_empty_array() );
if ( $additional_checks ):?>
<h4><?php _e( 'Additional Server Modules', 'w3-total-cache' )?></h4>
<ul>
<?php
foreach ( $additional_checks as $check )
echo '<li>', $check, '</li>';
?>
</ul>
<?php
endif;
?>
<h4><?php _e( 'WordPress Resources', 'w3-total-cache' ); ?></h4>
<ul>
<?php
$paths = array_unique( array(
Util_Rule::get_pgcache_rules_core_path(),
Util_Rule::get_browsercache_rules_cache_path(),
Util_Rule::get_browsercache_rules_no404wp_path()
) );
?>
<?php foreach ( $paths as $path ): if ( $path ): ?>
<li>
<?php echo htmlspecialchars( $path ); ?>:
<?php if ( file_exists( $path ) ): ?>
<?php if ( Util_File::is_writable( $path ) ): ?>
<code><?php _e( 'OK', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not write-able', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<?php else: ?>
<?php if ( Util_File::is_writable_dir( dirname( $path ) ) ): ?>
<code><?php _e( 'Write-able', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not write-able', 'w3-total-cache' ); ?></code>
<?php endif; ?>
<?php endif; ?>
</li>
<?php endif; endforeach; ?>
<li>
<?php echo Util_Environment::normalize_path( WP_CONTENT_DIR ); ?>:
<?php if ( Util_File::is_writable_dir( WP_CONTENT_DIR ) ): ?>
<code><?php _e( 'OK', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Not write-able', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php $uploads_dir = @wp_upload_dir(); ?>
<?php echo htmlspecialchars( $uploads_dir['path'] ); ?>:
<?php if ( !empty( $uploads_dir['error'] ) ): ?>
<code><?php _e( 'Error:', 'w3-total-cache' ); ?> <?php echo htmlspecialchars( $uploads_dir['error'] ); ?></code>
<?php elseif ( !Util_File::is_writable_dir( $uploads_dir['path'] ) ): ?>
<code><?php _e( 'Not write-able', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'OK', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'Fancy permalinks:', 'w3-total-cache' ); ?>
<?php $permalink_structure = get_option( 'permalink_structure' ); if ( $permalink_structure ): ?>
<code><?php echo htmlspecialchars( $permalink_structure ); ?></code>
<?php else: ?>
<code><?php _e( 'Disabled', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'WP_CACHE define:', 'w3-total-cache' ); ?>
<?php if ( defined( 'WP_CACHE' ) ): ?>
<code><?php _e( 'Defined', 'w3-total-cache' ); ?> (<?php echo WP_CACHE ? 'true' : 'false'; ?>)</code>
<?php else: ?>
<code><?php _e( 'Not defined', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'URL rewrite:', 'w3-total-cache' ); ?>
<?php if ( Util_Rule::can_check_rules() ): ?>
<code><?php _e( 'Enabled', 'w3-total-cache' ); ?></code>
<?php else: ?>
<code><?php _e( 'Disabled', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
<li>
<?php _e( 'Network mode:', 'w3-total-cache' ); ?>
<?php if ( Util_Environment::is_wpmu() ): ?>
<code><?php _e( 'Yes', 'w3-total-cache' ); ?> (<?php echo Util_Environment::is_wpmu_subdomain() ? 'subdomain' : 'subdir'; ?>)</code>
<?php else: ?>
<code><?php _e( 'No', 'w3-total-cache' ); ?></code>
<?php endif; ?>
</li>
</ul>
</div>
<div id="w3tc-self-test-bottom">
<input class="button-primary" type="button" value="<?php _e( 'Close', 'w3-total-cache' ); ?>" />
</div>