]> git.immae.eu Git - github/wallabag/wallabag.git/blame - wallabag_compatibility_test.php
Fix #657 and postgresql problems
[github/wallabag/wallabag.git] / wallabag_compatibility_test.php
CommitLineData
6fa7d088 1<?php
d6073305 2$app_name = 'wallabag';
6fa7d088 3
35252364 4$php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.3.3', '>='));
6fa7d088
NL
5$pcre_ok = extension_loaded('pcre');
6$zlib_ok = extension_loaded('zlib');
7$mbstring_ok = extension_loaded('mbstring');
8$iconv_ok = extension_loaded('iconv');
9$tidy_ok = function_exists('tidy_parse_string');
10$curl_ok = function_exists('curl_exec');
11$parallel_ok = ((extension_loaded('http') && class_exists('HttpRequestPool')) || ($curl_ok && function_exists('curl_multi_init')));
12$allow_url_fopen_ok = (bool)ini_get('allow_url_fopen');
13$filter_ok = extension_loaded('filter');
d6073305 14$gettext_ok = function_exists("gettext");
6fa7d088
NL
15
16if (extension_loaded('xmlreader')) {
17 $xml_ok = true;
18} elseif (extension_loaded('xml')) {
19 $parser_check = xml_parser_create();
20 xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
21 xml_parser_free($parser_check);
22 $xml_ok = isset($values[0]['value']);
23} else {
24 $xml_ok = false;
25}
26
27header('Content-type: text/html; charset=UTF-8');
28
29?><!DOCTYPE html>
30
31<html lang="en">
32<head>
33<title><?php echo $app_name; ?>: Server Compatibility Test</title>
34
35<style type="text/css">
36body {
37 font:14px/1.4em "Lucida Grande", Verdana, Arial, Helvetica, Clean, Sans, sans-serif;
38 letter-spacing:0px;
39 color:#333;
40 margin:0;
41 padding:0;
42 background:#fff;
43}
44
45div#site {
46 width:550px;
47 margin:20px auto 0 auto;
48}
49
50a {
51 color:#000;
52 text-decoration:underline;
53 padding:0 1px;
54}
55
56a:hover {
57 color:#fff;
58 background-color:#333;
59 text-decoration:none;
60 padding:0 1px;
61}
62
63p {
64 margin:0;
65 padding:5px 0;
66}
67
68em {
69 font-style:normal;
70 background-color:#ffc;
71 padding: 0.1em 0;
72}
73
74ul, ol {
75 margin:10px 0 10px 20px;
76 padding:0 0 0 15px;
77}
78
79ul li, ol li {
80 margin:0 0 7px 0;
81 padding:0 0 0 3px;
82}
83
84h2 {
85 font-size:18px;
86 padding:0;
87 margin:30px 0 20px 0;
88}
89
90h3 {
91 font-size:16px;
92 padding:0;
93 margin:20px 0 5px 0;
94}
95
96h4 {
97 font-size:14px;
98 padding:0;
99 margin:15px 0 5px 0;
100}
101
102code {
103 font-size:1.1em;
104 background-color:#f3f3ff;
105 color:#000;
106}
107
108em strong {
109 text-transform: uppercase;
110}
111
112table#chart {
113 border-collapse:collapse;
114}
115
116table#chart th {
117 background-color:#eee;
118 padding:2px 3px;
119 border:1px solid #fff;
120}
121
122table#chart td {
123 text-align:center;
124 padding:2px 3px;
125 border:1px solid #eee;
126}
127
128table#chart tr.enabled td {
129 /* Leave this alone */
130}
131
132table#chart tr.disabled td,
133table#chart tr.disabled td a {
6fa7d088
NL
134}
135
136table#chart tr.disabled td a {
137 text-decoration:underline;
138}
139
140div.chunk {
141 margin:20px 0 0 0;
142 padding:0 0 10px 0;
143 border-bottom:1px solid #ccc;
144}
145
146.footnote,
147.footnote a {
148 font:10px/12px verdana, sans-serif;
149 color:#aaa;
150}
151
152.footnote em {
153 background-color:transparent;
154 font-style:italic;
155}
d6073305 156
157.good{
158background-color:#52CC5B;
159}
160.bad{
161background-color:#F74343;
162font-style:italic;
163font-weight: bold;
164}
165.pass{
166background-color:#FF9500;
167}
168
6fa7d088
NL
169</style>
170
171</head>
172
173<body>
fecb62a3 174<?php
175$frominstall = false;
176if (isset($_GET['from'])){
177 if ($_GET['from'] == 'install'){
178 $frominstall = true;
179 }}
180?>
6fa7d088
NL
181<div id="site">
182 <div id="content">
183
184 <div class="chunk">
185 <h2 style="text-align:center;"><?php echo $app_name; ?>: Compatibility Test</h2>
186 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="chart">
187 <thead>
188 <tr>
189 <th>Test</th>
190 <th>Should Be</th>
191 <th>What You Have</th>
192 </tr>
193 </thead>
194 <tbody>
195 <tr class="<?php echo ($php_ok) ? 'enabled' : 'disabled'; ?>">
196 <td>PHP</td>
792097fb 197 <td>5.3.3 or higher</td>
d6073305 198 <td class="<?php echo ($php_ok) ? 'good' : 'disabled'; ?>"><?php echo phpversion(); ?></td>
6fa7d088 199 </tr>
d6073305 200 <tr class="<?php echo ($xml_ok) ? 'enabled' : 'disabled'; ?>">
6fa7d088
NL
201 <td><a href="http://php.net/xml">XML</a></td>
202 <td>Enabled</td>
d6073305 203 <?php echo ($xml_ok) ? '<td class="good">Enabled, and sane</span>' : '<td class="bad">Disabled, or broken'; ?></td>
6fa7d088
NL
204 </tr>
205 <tr class="<?php echo ($pcre_ok) ? 'enabled' : 'disabled'; ?>">
206 <td><a href="http://php.net/pcre">PCRE</a></td>
207 <td>Enabled</td>
d6073305 208 <?php echo ($pcre_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088
NL
209 </tr>
210<!-- <tr class="<?php echo ($zlib_ok) ? 'enabled' : 'disabled'; ?>">
211 <td><a href="http://php.net/zlib">Zlib</a></td>
212 <td>Enabled</td>
d6073305 213 <?php echo ($zlib_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088
NL
214 </tr> -->
215<!-- <tr class="<?php echo ($mbstring_ok) ? 'enabled' : 'disabled'; ?>">
216 <td><a href="http://php.net/mbstring">mbstring</a></td>
217 <td>Enabled</td>
d6073305 218 <?php echo ($mbstring_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088
NL
219 </tr> -->
220<!-- <tr class="<?php echo ($iconv_ok) ? 'enabled' : 'disabled'; ?>">
221 <td><a href="http://php.net/iconv">iconv</a></td>
222 <td>Enabled</td>
d6073305 223 <?php echo ($iconv_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088
NL
224 </tr> -->
225 <tr class="<?php echo ($filter_ok) ? 'enabled' : 'disabled'; ?>">
226 <td><a href="http://uk.php.net/manual/en/book.filter.php">Data filtering</a></td>
227 <td>Enabled</td>
d6073305 228 <?php echo ($filter_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088
NL
229 </tr>
230 <tr class="<?php echo ($tidy_ok) ? 'enabled' : 'disabled'; ?>">
231 <td><a href="http://php.net/tidy">Tidy</a></td>
232 <td>Enabled</td>
d6073305 233 <?php echo ($tidy_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088
NL
234 </tr>
235 <tr class="<?php echo ($curl_ok) ? 'enabled' : 'disabled'; ?>">
236 <td><a href="http://php.net/curl">cURL</a></td>
237 <td>Enabled</td>
d6073305 238 <?php echo (extension_loaded('curl')) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088
NL
239 </tr>
240 <tr class="<?php echo ($parallel_ok) ? 'enabled' : 'disabled'; ?>">
241 <td>Parallel URL fetching</td>
242 <td>Enabled</td>
d6073305 243 <?php echo ($parallel_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088
NL
244 </tr>
245 <tr class="<?php echo ($allow_url_fopen_ok) ? 'enabled' : 'disabled'; ?>">
246 <td><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen">allow_url_fopen</a></td>
247 <td>Enabled</td>
d6073305 248 <?php echo ($allow_url_fopen_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
249 </tr>
250 <tr class="<?php echo ($gettext_ok) ? 'enabled' : 'disabled'; ?>">
251 <td><a href="http://php.net/manual/en/book.gettext.php">gettext</a></td>
252 <td>Enabled</td>
253 <?php echo ($gettext_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
254 </tr>
6fa7d088
NL
255 </tbody>
256 </table>
257 </div>
258
259 <div class="chunk">
260 <h3>What does this mean?</h3>
261 <ol>
262 <?php //if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $iconv_ok && $filter_ok && $zlib_ok && $tidy_ok && $curl_ok && $parallel_ok && $allow_url_fopen_ok): ?>
d6073305 263 <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $tidy_ok && $curl_ok && $parallel_ok && $allow_url_fopen_ok && $gettext_ok): ?>
6fa7d088
NL
264 <li><em>You have everything you need to run <?php echo $app_name; ?> properly! Congratulations!</em></li>
265 <?php else: ?>
266 <?php if ($php_ok): ?>
267 <li><strong>PHP:</strong> You are running a supported version of PHP. <em>No problems here.</em></li>
268 <?php if ($xml_ok): ?>
269 <li><strong>XML:</strong> You have XMLReader support or a version of XML support that isn't broken installed. <em>No problems here.</em></li>
270 <?php if ($pcre_ok): ?>
271 <li><strong>PCRE:</strong> You have PCRE support installed. <em>No problems here.</em></li>
272
273 <?php if ($allow_url_fopen_ok): ?>
274 <li><strong>allow_url_fopen:</strong> You have allow_url_fopen enabled. <em>No problems here.</em></li>
275
d6073305 276 <?php if ($gettext_ok): ?>
277 <li><strong>Gettext:</strong> You have <code>gettext</code> enabled. <em>No problems here.</em></li>
278
279 <?php if ($filter_ok): ?>
280 <li><strong>Data filtering:</strong> You have the PHP filter extension enabled. <em>No problems here.</em></li>
6fa7d088 281
d6073305 282 <?php if ($zlib_ok): ?>
283 <li><strong>Zlib:</strong> You have <code>Zlib</code> enabled. This allows SimplePie to support GZIP-encoded feeds. <em>No problems here.</em></li>
284 <?php else: ?>
285 <li><strong>Zlib:</strong> The <code>Zlib</code> extension is not available. SimplePie will ignore any GZIP-encoding, and instead handle feeds as uncompressed text.</li>
286 <?php endif; ?>
287
288 <?php if ($mbstring_ok && $iconv_ok): ?>
289 <li><strong>mbstring and iconv:</strong> You have both <code>mbstring</code> and <code>iconv</code> installed! This will allow <?php echo $app_name; ?> to handle the greatest number of languages. <em>No problems here.</em></li>
290 <?php elseif ($mbstring_ok): ?>
291 <li><strong>mbstring:</strong> <code>mbstring</code> is installed, but <code>iconv</code> is not.</li>
292 <?php elseif ($iconv_ok): ?>
293 <li><strong>iconv:</strong> <code>iconv</code> is installed, but <code>mbstring</code> is not.</li>
294 <?php else: ?>
295 <li><strong>mbstring and iconv:</strong> <em>You do not have either of the extensions installed.</em> This will significantly impair your ability to read non-English feeds, as well as even some English ones.</li>
296 <?php endif; ?>
297
298 <?php if ($tidy_ok): ?>
299 <li><strong>Tidy:</strong> You have <code>Tidy</code> support installed. <em>No problems here.</em></li>
300 <?php else: ?>
301 <li><strong>Tidy:</strong> The <code>Tidy</code> extension is not available. <?php echo $app_name; ?> should still work with most feeds, but you may experience problems with some.</li>
302 <?php endif; ?>
303
304 <?php if ($curl_ok): ?>
305 <li><strong>cURL:</strong> You have <code>cURL</code> support installed. <em>No problems here.</em></li>
306 <?php else: ?>
307 <li><strong>cURL:</strong> The <code>cURL</code> extension is not available. SimplePie will use <code>fsockopen()</code> instead.</li>
308 <?php endif; ?>
6fa7d088 309
d6073305 310 <?php if ($parallel_ok): ?>
311 <li><strong>Parallel URL fetching:</strong> You have <code>HttpRequestPool</code> or <code>curl_multi</code> support installed. <em>No problems here.</em></li>
312 <?php else: ?>
313 <li><strong>Parallel URL fetching:</strong> <code>HttpRequestPool</code> or <code>curl_multi</code> support is not available. <?php echo $app_name; ?> will use <code>file_get_contents()</code> instead to fetch URLs sequentially rather than in parallel.</li>
314 <?php endif; ?>
6fa7d088 315
6fa7d088 316 <?php else: ?>
d6073305 317 <li><strong>Data filtering:</strong> Your PHP configuration has the filter extension disabled. <strong><?php echo $app_name; ?> will not work here.</strong></li>
6fa7d088
NL
318 <?php endif; ?>
319
6fa7d088 320 <?php else: ?>
d6073305 321 <li><strong>GetText:</strong> The <code>gettext</code> extension is not available. The system we use to display wallabag in various languages is not available. <strong><?php echo $app_name; ?> will not work here.</strong></li>
322 <?php endif; ?>
6fa7d088
NL
323
324 <?php else: ?>
d6073305 325 <li><strong>allow_url_fopen:</strong> Your PHP configuration has allow_url_fopen disabled. <strong><?php echo $app_name; ?> will not work here.</strong></li>
6fa7d088
NL
326 <?php endif; ?>
327
328 <?php else: ?>
d6073305 329 <li><strong>PCRE:</strong> Your PHP installation doesn't support Perl-Compatible Regular Expressions. <strong><?php echo $app_name; ?> will not work here.</strong></li>
6fa7d088
NL
330 <?php endif; ?>
331 <?php else: ?>
d6073305 332 <li><strong>XML:</strong> Your PHP installation doesn't support XML parsing. <strong><?php echo $app_name; ?> will not work here.</strong></li>
6fa7d088
NL
333 <?php endif; ?>
334 <?php else: ?>
d6073305 335 <li><strong>PHP:</strong> You are running an unsupported version of PHP. <strong><?php echo $app_name; ?> will not work here.</strong></li>
6fa7d088
NL
336 <?php endif; ?>
337 <?php endif; ?>
338 </ol>
339 </div>
340
341 <div class="chunk">
342 <?php //if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $iconv_ok && $filter_ok && $allow_url_fopen_ok) { ?>
d6073305 343 <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $allow_url_fopen_ok && $gettext_ok) { ?>
6fa7d088
NL
344 <h3>Bottom Line: Yes, you can!</h3>
345 <p><em>Your webhost has its act together!</em></p>
fecb62a3 346 <?php if (!$frominstall) { ?>
c95b78a8 347 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p>
fecb62a3 348 <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and/or start using wallabag</p>
349 <?php } else { ?>
350 <p>You can now <a href="index.php">return to the installation section</a>.</p>
351 <?php } ?>
6fa7d088
NL
352 <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost &mdash; it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p>
353 <?php //} else if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $allow_url_fopen_ok && $filter_ok) { ?>
d6073305 354 <?php } else if ($php_ok && $xml_ok && $pcre_ok && $allow_url_fopen_ok && $filter_ok && $gettext_ok) { ?>
6fa7d088
NL
355 <h3>Bottom Line: Yes, you can!</h3>
356 <p><em>For most feeds, it'll run with no problems.</em> There are certain languages that you might have a hard time with though.</p>
fecb62a3 357 <?php if (!$frominstall) { ?>
c95b78a8 358 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p>
fecb62a3 359 <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and/or start using wallabag</p>
360 <?php } else { ?>
361 <p>You can now <a href="index.php">return to the installation section</a>.</p>
362 <?php } ?>
6fa7d088
NL
363 <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost &mdash; it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p>
364 <?php } else { ?>
365 <h3>Bottom Line: We're sorry…</h3>
366 <p><em>Your webhost does not support the minimum requirements for <?php echo $app_name; ?>.</em> It may be a good idea to contact your webhost and point them to the results of this test. They may be able to enable/install the required components.</p>
367 <?php } ?>
368 </div>
369
370 <div class="chunk">
371 <p class="footnote">This compatibility test has been borrowed (and slightly adapted by <a href="http://fivefilters.org/content-only/">fivefilters.org</a>) from the one supplied by <a href="http://simplepie.org/">SimplePie.org</a>.</a></p>
372 </div>
373
374 </div>
375
376</div>
377
378</body>
379</html>