]> git.immae.eu Git - github/wallabag/wallabag.git/blame - bin/compatibility.php
add install script after composer install
[github/wallabag/wallabag.git] / bin / compatibility.php
CommitLineData
6fa7d088 1<?php
3602405e
NL
2/**
3 * wallabag, self hostable application allowing you to not miss any content anymore
4 *
5 * @category wallabag
6 * @author Nicolas Lœuillet <nicolas@loeuillet.org>
7 * @copyright 2013
8 * @license http://opensource.org/licenses/MIT see COPYING file
9 */
10
d6073305 11$app_name = 'wallabag';
6fa7d088 12
35252364 13$php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.3.3', '>='));
6fa7d088
NL
14$pcre_ok = extension_loaded('pcre');
15$zlib_ok = extension_loaded('zlib');
16$mbstring_ok = extension_loaded('mbstring');
ace42866 17$dom_ok = extension_loaded('DOM');
6fa7d088
NL
18$iconv_ok = extension_loaded('iconv');
19$tidy_ok = function_exists('tidy_parse_string');
20$curl_ok = function_exists('curl_exec');
becc5bfb 21$parse_ini_ok = function_exists('parse_ini_file');
6fa7d088
NL
22$parallel_ok = ((extension_loaded('http') && class_exists('HttpRequestPool')) || ($curl_ok && function_exists('curl_multi_init')));
23$allow_url_fopen_ok = (bool)ini_get('allow_url_fopen');
24$filter_ok = extension_loaded('filter');
d6073305 25$gettext_ok = function_exists("gettext");
bbfe6fa5 26$gd_ok = extension_loaded('gd');
6fa7d088 27
ace42866 28
6fa7d088
NL
29if (extension_loaded('xmlreader')) {
30 $xml_ok = true;
31} elseif (extension_loaded('xml')) {
32 $parser_check = xml_parser_create();
33 xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
34 xml_parser_free($parser_check);
35 $xml_ok = isset($values[0]['value']);
36} else {
37 $xml_ok = false;
38}
39
40header('Content-type: text/html; charset=UTF-8');
41
42?><!DOCTYPE html>
43
44<html lang="en">
45<head>
46<title><?php echo $app_name; ?>: Server Compatibility Test</title>
47
48<style type="text/css">
49body {
50 font:14px/1.4em "Lucida Grande", Verdana, Arial, Helvetica, Clean, Sans, sans-serif;
51 letter-spacing:0px;
52 color:#333;
53 margin:0;
54 padding:0;
55 background:#fff;
56}
57
58div#site {
59 width:550px;
60 margin:20px auto 0 auto;
61}
62
63a {
64 color:#000;
65 text-decoration:underline;
66 padding:0 1px;
67}
68
69a:hover {
70 color:#fff;
71 background-color:#333;
72 text-decoration:none;
73 padding:0 1px;
74}
75
76p {
77 margin:0;
78 padding:5px 0;
79}
80
81em {
82 font-style:normal;
83 background-color:#ffc;
84 padding: 0.1em 0;
85}
86
87ul, ol {
88 margin:10px 0 10px 20px;
89 padding:0 0 0 15px;
90}
91
92ul li, ol li {
93 margin:0 0 7px 0;
94 padding:0 0 0 3px;
95}
96
97h2 {
98 font-size:18px;
99 padding:0;
100 margin:30px 0 20px 0;
101}
102
103h3 {
104 font-size:16px;
105 padding:0;
106 margin:20px 0 5px 0;
107}
108
109h4 {
110 font-size:14px;
111 padding:0;
112 margin:15px 0 5px 0;
113}
114
115code {
116 font-size:1.1em;
117 background-color:#f3f3ff;
118 color:#000;
119}
120
121em strong {
122 text-transform: uppercase;
123}
124
125table#chart {
126 border-collapse:collapse;
127}
128
129table#chart th {
130 background-color:#eee;
131 padding:2px 3px;
132 border:1px solid #fff;
133}
134
135table#chart td {
136 text-align:center;
137 padding:2px 3px;
138 border:1px solid #eee;
139}
140
141table#chart tr.enabled td {
142 /* Leave this alone */
143}
144
145table#chart tr.disabled td,
146table#chart tr.disabled td a {
6fa7d088
NL
147}
148
149table#chart tr.disabled td a {
150 text-decoration:underline;
151}
152
153div.chunk {
154 margin:20px 0 0 0;
155 padding:0 0 10px 0;
156 border-bottom:1px solid #ccc;
157}
158
159.footnote,
160.footnote a {
161 font:10px/12px verdana, sans-serif;
162 color:#aaa;
163}
164
165.footnote em {
166 background-color:transparent;
167 font-style:italic;
168}
d6073305 169
170.good{
171background-color:#52CC5B;
172}
173.bad{
174background-color:#F74343;
175font-style:italic;
176font-weight: bold;
177}
178.pass{
179background-color:#FF9500;
180}
181
6fa7d088
NL
182</style>
183
184</head>
185
186<body>
fecb62a3 187<?php
188$frominstall = false;
189if (isset($_GET['from'])){
190 if ($_GET['from'] == 'install'){
191 $frominstall = true;
192 }}
193?>
6fa7d088
NL
194<div id="site">
195 <div id="content">
196
197 <div class="chunk">
198 <h2 style="text-align:center;"><?php echo $app_name; ?>: Compatibility Test</h2>
199 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="chart">
200 <thead>
201 <tr>
202 <th>Test</th>
203 <th>Should Be</th>
204 <th>What You Have</th>
205 </tr>
206 </thead>
207 <tbody>
208 <tr class="<?php echo ($php_ok) ? 'enabled' : 'disabled'; ?>">
209 <td>PHP</td>
792097fb 210 <td>5.3.3 or higher</td>
d6073305 211 <td class="<?php echo ($php_ok) ? 'good' : 'disabled'; ?>"><?php echo phpversion(); ?></td>
6fa7d088 212 </tr>
d6073305 213 <tr class="<?php echo ($xml_ok) ? 'enabled' : 'disabled'; ?>">
6fa7d088
NL
214 <td><a href="http://php.net/xml">XML</a></td>
215 <td>Enabled</td>
d6073305 216 <?php echo ($xml_ok) ? '<td class="good">Enabled, and sane</span>' : '<td class="bad">Disabled, or broken'; ?></td>
6fa7d088
NL
217 </tr>
218 <tr class="<?php echo ($pcre_ok) ? 'enabled' : 'disabled'; ?>">
219 <td><a href="http://php.net/pcre">PCRE</a></td>
220 <td>Enabled</td>
d6073305 221 <?php echo ($pcre_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088
NL
222 </tr>
223<!-- <tr class="<?php echo ($zlib_ok) ? 'enabled' : 'disabled'; ?>">
224 <td><a href="http://php.net/zlib">Zlib</a></td>
225 <td>Enabled</td>
d6073305 226 <?php echo ($zlib_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088
NL
227 </tr> -->
228<!-- <tr class="<?php echo ($mbstring_ok) ? 'enabled' : 'disabled'; ?>">
229 <td><a href="http://php.net/mbstring">mbstring</a></td>
230 <td>Enabled</td>
d6073305 231 <?php echo ($mbstring_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088
NL
232 </tr> -->
233<!-- <tr class="<?php echo ($iconv_ok) ? 'enabled' : 'disabled'; ?>">
234 <td><a href="http://php.net/iconv">iconv</a></td>
235 <td>Enabled</td>
d6073305 236 <?php echo ($iconv_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
6fa7d088 237 </tr> -->
ace42866 238 <tr class="<?php echo ($dom_ok) ? 'enabled' : 'disabled'; ?>">
239 <td><a href="http://php.net/manual/en/book.dom.php">DOM / XML extension</a></td>
240 <td>Enabled</td>
241 <?php echo ($dom_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
242 </tr>
6fa7d088
NL
243 <tr class="<?php echo ($filter_ok) ? 'enabled' : 'disabled'; ?>">
244 <td><a href="http://uk.php.net/manual/en/book.filter.php">Data filtering</a></td>
245 <td>Enabled</td>
d6073305 246 <?php echo ($filter_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
bbfe6fa5
TC
247 </tr>
248 <tr class="<?php echo ($gd_ok) ? 'enabled' : 'disabled'; ?>">
249 <td><a href="http://php.net/manual/en/book.image.php">GD</a></td>
250 <td>Enabled</td>
251 <?php echo ($gd_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088
NL
252 </tr>
253 <tr class="<?php echo ($tidy_ok) ? 'enabled' : 'disabled'; ?>">
254 <td><a href="http://php.net/tidy">Tidy</a></td>
255 <td>Enabled</td>
d6073305 256 <?php echo ($tidy_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088
NL
257 </tr>
258 <tr class="<?php echo ($curl_ok) ? 'enabled' : 'disabled'; ?>">
259 <td><a href="http://php.net/curl">cURL</a></td>
260 <td>Enabled</td>
d6073305 261 <?php echo (extension_loaded('curl')) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088 262 </tr>
becc5bfb 263 <tr class="<?php echo ($parse_ini_ok) ? 'enabled' : 'disabled'; ?>">
264 <td><a href="http://uk.php.net/manual/en/function.parse-ini-file.php">Parse ini file</td>
265 <td>Enabled</td>
266 <?php echo ($parse_ini_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
267 </tr>
6fa7d088
NL
268 <tr class="<?php echo ($parallel_ok) ? 'enabled' : 'disabled'; ?>">
269 <td>Parallel URL fetching</td>
270 <td>Enabled</td>
d6073305 271 <?php echo ($parallel_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td>
6fa7d088
NL
272 </tr>
273 <tr class="<?php echo ($allow_url_fopen_ok) ? 'enabled' : 'disabled'; ?>">
274 <td><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen">allow_url_fopen</a></td>
275 <td>Enabled</td>
d6073305 276 <?php echo ($allow_url_fopen_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
277 </tr>
278 <tr class="<?php echo ($gettext_ok) ? 'enabled' : 'disabled'; ?>">
279 <td><a href="http://php.net/manual/en/book.gettext.php">gettext</a></td>
280 <td>Enabled</td>
281 <?php echo ($gettext_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
282 </tr>
6fa7d088
NL
283 </tbody>
284 </table>
285 </div>
286
287 <div class="chunk">
288 <h3>What does this mean?</h3>
289 <ol>
290 <?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): ?>
ace42866 291 <?php if ($php_ok && $xml_ok && $pcre_ok && $dom_ok && $filter_ok && $gd_ok && $tidy_ok && $curl_ok && $parallel_ok && $allow_url_fopen_ok && $gettext_ok && $parse_ini_ok): ?>
6fa7d088
NL
292 <li><em>You have everything you need to run <?php echo $app_name; ?> properly! Congratulations!</em></li>
293 <?php else: ?>
294 <?php if ($php_ok): ?>
295 <li><strong>PHP:</strong> You are running a supported version of PHP. <em>No problems here.</em></li>
296 <?php if ($xml_ok): ?>
297 <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>
298 <?php if ($pcre_ok): ?>
299 <li><strong>PCRE:</strong> You have PCRE support installed. <em>No problems here.</em></li>
300
301 <?php if ($allow_url_fopen_ok): ?>
302 <li><strong>allow_url_fopen:</strong> You have allow_url_fopen enabled. <em>No problems here.</em></li>
303
d6073305 304 <?php if ($gettext_ok): ?>
305 <li><strong>Gettext:</strong> You have <code>gettext</code> enabled. <em>No problems here.</em></li>
becc5bfb 306
307 <?php if ($parse_ini_ok): ?>
ace42866 308 <li><strong>Parse ini:</strong> You can parse <em>ini</em> files. <em>No problems here.</em></li>
309
310 <?php if ($dom_ok): ?>
311 <li><strong>DOM/XML:</strong> You can parse <em>ini</em> files. <em>No problems here.</em></li>
becc5bfb 312
ace42866 313 <?php if ($filter_ok): ?>
314 <li><strong>Data filtering:</strong> You can use the PHP build-in DOM to operate on XML documents. <em>No problems here.</em></li>
315
316 <?php if ($zlib_ok): ?>
317 <li><strong>Zlib:</strong> You have <code>Zlib</code> enabled. This allows SimplePie to support GZIP-encoded feeds. <em>No problems here.</em></li>
318 <?php else: ?>
319 <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>
320 <?php endif; ?>
321
322 <?php if ($mbstring_ok && $iconv_ok): ?>
323 <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>
324 <?php elseif ($mbstring_ok): ?>
325 <li><strong>mbstring:</strong> <code>mbstring</code> is installed, but <code>iconv</code> is not.</li>
326 <?php elseif ($iconv_ok): ?>
327 <li><strong>iconv:</strong> <code>iconv</code> is installed, but <code>mbstring</code> is not.</li>
328 <?php else: ?>
329 <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>
330 <?php endif; ?>
331
332 <?php if ($gd_ok): ?>
333 <li><strong>GD:</strong> You have <code>GD</code> support installed. <em>No problems here.</em></li>
334 <?php else: ?>
335 <li><strong>GD:</strong> The <code>GD</code> extension is not available. <?php echo $app_name; ?> will not be able to download pictures locally on your server.</li>
336 <?php endif; ?>
337
338 <?php if ($tidy_ok): ?>
339 <li><strong>Tidy:</strong> You have <code>Tidy</code> support installed. <em>No problems here.</em></li>
340 <?php else: ?>
66d7a4dc 341 <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. You can install it with <code>sudo apt-get install php5-tidy</code> and then reload Apache <code>sudo service apache2 reload</code>.</li>
ace42866 342 <?php endif; ?>
343
344 <?php if ($curl_ok): ?>
345 <li><strong>cURL:</strong> You have <code>cURL</code> support installed. <em>No problems here.</em></li>
346 <?php else: ?>
347 <li><strong>cURL:</strong> The <code>cURL</code> extension is not available. SimplePie will use <code>fsockopen()</code> instead.</li>
348 <?php endif; ?>
349
350 <?php if ($parallel_ok): ?>
351 <li><strong>Parallel URL fetching:</strong> You have <code>HttpRequestPool</code> or <code>curl_multi</code> support installed. <em>No problems here.</em></li>
352 <?php else: ?>
353 <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>
354 <?php endif; ?>
355
356 <?php else: ?>
357 <li><strong>Data filtering:</strong> Your PHP configuration has the filter extension disabled. <strong><?php echo $app_name; ?> will not work here.</strong></li>
358 <?php endif; ?>
359
360 <?php else: ?>
361 <li><strong>DOM/XML:</strong> Your PHP configuration isn't standard, you're missing PHP-DOM. You may try to install a package or recompile PHP. <strong><?php echo $app_name; ?> will not work here.</strong></li>
362 <?php endif; ?>
363
becc5bfb 364 <?php else : ?>
365 <li><strong>Parse ini files function :</strong> Bad luck : your webhost has decided to block the use of the <em>parse_ini_file</em> function. <strong><?php echo $app_name; ?> will not work here.</strong>
366 <?php endif; ?>
6fa7d088 367
6fa7d088 368 <?php else: ?>
d6073305 369 <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>
370 <?php endif; ?>
6fa7d088
NL
371
372 <?php else: ?>
d6073305 373 <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
374 <?php endif; ?>
375
376 <?php else: ?>
d6073305 377 <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
378 <?php endif; ?>
379 <?php else: ?>
d6073305 380 <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
381 <?php endif; ?>
382 <?php else: ?>
d6073305 383 <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
384 <?php endif; ?>
385 <?php endif; ?>
386 </ol>
387 </div>
388
389 <div class="chunk">
390 <?php //if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $iconv_ok && $filter_ok && $allow_url_fopen_ok) { ?>
becc5bfb 391 <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $allow_url_fopen_ok && $gettext_ok && $parse_ini_ok) { ?>
6fa7d088
NL
392 <h3>Bottom Line: Yes, you can!</h3>
393 <p><em>Your webhost has its act together!</em></p>
fecb62a3 394 <?php if (!$frominstall) { ?>
c95b78a8 395 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p>
fecb62a3 396 <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>
397 <?php } else { ?>
a7058a5a 398 <p>You can now <a href="../index.php">return to the installation section</a>.</p>
fecb62a3 399 <?php } ?>
6fa7d088
NL
400 <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>
401 <?php //} else if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $allow_url_fopen_ok && $filter_ok) { ?>
becc5bfb 402 <?php } else if ($php_ok && $xml_ok && $pcre_ok && $allow_url_fopen_ok && $filter_ok && $gettext_ok && $parse_ini_ok) { ?>
6fa7d088
NL
403 <h3>Bottom Line: Yes, you can!</h3>
404 <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 405 <?php if (!$frominstall) { ?>
c95b78a8 406 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p>
fecb62a3 407 <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>
408 <?php } else { ?>
a7058a5a 409 <p>You can now <a href="../index.php">return to the installation section</a>.</p>
fecb62a3 410 <?php } ?>
6fa7d088
NL
411 <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>
412 <?php } else { ?>
413 <h3>Bottom Line: We're sorry…</h3>
414 <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>
415 <?php } ?>
416 </div>
417
418 <div class="chunk">
419 <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>
420 </div>
421
422 </div>
423
424</div>
425
426</body>
66d7a4dc 427</html>