diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-02-03 10:03:41 -0800 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-02-03 10:03:41 -0800 |
commit | 38dafee05d52948fba4a06066d7b0343c8e3de9d (patch) | |
tree | 2e3f7bd3a58bfdb046742c3e65ff082e31a9859b /wallabag_compatibility_test.php | |
parent | f355d2c87fa441221ca8a9339c426c1c95e7c2ac (diff) | |
parent | fa0bfb775a53a074e0a9d642298685b5ed1af83f (diff) | |
download | wallabag-38dafee05d52948fba4a06066d7b0343c8e3de9d.tar.gz wallabag-38dafee05d52948fba4a06066d7b0343c8e3de9d.tar.zst wallabag-38dafee05d52948fba4a06066d7b0343c8e3de9d.zip |
Merge pull request #427 from wallabag/dev1.4.0
changelog 1.4
Diffstat (limited to 'wallabag_compatibility_test.php')
-rw-r--r-- | wallabag_compatibility_test.php | 339 |
1 files changed, 339 insertions, 0 deletions
diff --git a/wallabag_compatibility_test.php b/wallabag_compatibility_test.php new file mode 100644 index 00000000..fd285042 --- /dev/null +++ b/wallabag_compatibility_test.php | |||
@@ -0,0 +1,339 @@ | |||
1 | <?php | ||
2 | $app_name = 'wallabag 1'; | ||
3 | |||
4 | $php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.3.3', '>=')); | ||
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'); | ||
14 | |||
15 | if (extension_loaded('xmlreader')) { | ||
16 | $xml_ok = true; | ||
17 | } elseif (extension_loaded('xml')) { | ||
18 | $parser_check = xml_parser_create(); | ||
19 | xml_parse_into_struct($parser_check, '<foo>&</foo>', $values); | ||
20 | xml_parser_free($parser_check); | ||
21 | $xml_ok = isset($values[0]['value']); | ||
22 | } else { | ||
23 | $xml_ok = false; | ||
24 | } | ||
25 | |||
26 | header('Content-type: text/html; charset=UTF-8'); | ||
27 | |||
28 | ?><!DOCTYPE html> | ||
29 | |||
30 | <html lang="en"> | ||
31 | <head> | ||
32 | <title><?php echo $app_name; ?>: Server Compatibility Test</title> | ||
33 | |||
34 | <style type="text/css"> | ||
35 | body { | ||
36 | font:14px/1.4em "Lucida Grande", Verdana, Arial, Helvetica, Clean, Sans, sans-serif; | ||
37 | letter-spacing:0px; | ||
38 | color:#333; | ||
39 | margin:0; | ||
40 | padding:0; | ||
41 | background:#fff; | ||
42 | } | ||
43 | |||
44 | div#site { | ||
45 | width:550px; | ||
46 | margin:20px auto 0 auto; | ||
47 | } | ||
48 | |||
49 | a { | ||
50 | color:#000; | ||
51 | text-decoration:underline; | ||
52 | padding:0 1px; | ||
53 | } | ||
54 | |||
55 | a:hover { | ||
56 | color:#fff; | ||
57 | background-color:#333; | ||
58 | text-decoration:none; | ||
59 | padding:0 1px; | ||
60 | } | ||
61 | |||
62 | p { | ||
63 | margin:0; | ||
64 | padding:5px 0; | ||
65 | } | ||
66 | |||
67 | em { | ||
68 | font-style:normal; | ||
69 | background-color:#ffc; | ||
70 | padding: 0.1em 0; | ||
71 | } | ||
72 | |||
73 | ul, ol { | ||
74 | margin:10px 0 10px 20px; | ||
75 | padding:0 0 0 15px; | ||
76 | } | ||
77 | |||
78 | ul li, ol li { | ||
79 | margin:0 0 7px 0; | ||
80 | padding:0 0 0 3px; | ||
81 | } | ||
82 | |||
83 | h2 { | ||
84 | font-size:18px; | ||
85 | padding:0; | ||
86 | margin:30px 0 20px 0; | ||
87 | } | ||
88 | |||
89 | h3 { | ||
90 | font-size:16px; | ||
91 | padding:0; | ||
92 | margin:20px 0 5px 0; | ||
93 | } | ||
94 | |||
95 | h4 { | ||
96 | font-size:14px; | ||
97 | padding:0; | ||
98 | margin:15px 0 5px 0; | ||
99 | } | ||
100 | |||
101 | code { | ||
102 | font-size:1.1em; | ||
103 | background-color:#f3f3ff; | ||
104 | color:#000; | ||
105 | } | ||
106 | |||
107 | em strong { | ||
108 | text-transform: uppercase; | ||
109 | } | ||
110 | |||
111 | table#chart { | ||
112 | border-collapse:collapse; | ||
113 | } | ||
114 | |||
115 | table#chart th { | ||
116 | background-color:#eee; | ||
117 | padding:2px 3px; | ||
118 | border:1px solid #fff; | ||
119 | } | ||
120 | |||
121 | table#chart td { | ||
122 | text-align:center; | ||
123 | padding:2px 3px; | ||
124 | border:1px solid #eee; | ||
125 | } | ||
126 | |||
127 | table#chart tr.enabled td { | ||
128 | /* Leave this alone */ | ||
129 | } | ||
130 | |||
131 | table#chart tr.disabled td, | ||
132 | table#chart tr.disabled td a { | ||
133 | color:#999; | ||
134 | font-style:italic; | ||
135 | } | ||
136 | |||
137 | table#chart tr.disabled td a { | ||
138 | text-decoration:underline; | ||
139 | } | ||
140 | |||
141 | div.chunk { | ||
142 | margin:20px 0 0 0; | ||
143 | padding:0 0 10px 0; | ||
144 | border-bottom:1px solid #ccc; | ||
145 | } | ||
146 | |||
147 | .footnote, | ||
148 | .footnote a { | ||
149 | font:10px/12px verdana, sans-serif; | ||
150 | color:#aaa; | ||
151 | } | ||
152 | |||
153 | .footnote em { | ||
154 | background-color:transparent; | ||
155 | font-style:italic; | ||
156 | } | ||
157 | </style> | ||
158 | |||
159 | </head> | ||
160 | |||
161 | <body> | ||
162 | |||
163 | <div id="site"> | ||
164 | <div id="content"> | ||
165 | |||
166 | <div class="chunk"> | ||
167 | <h2 style="text-align:center;"><?php echo $app_name; ?>: Compatibility Test</h2> | ||
168 | <table cellpadding="0" cellspacing="0" border="0" width="100%" id="chart"> | ||
169 | <thead> | ||
170 | <tr> | ||
171 | <th>Test</th> | ||
172 | <th>Should Be</th> | ||
173 | <th>What You Have</th> | ||
174 | </tr> | ||
175 | </thead> | ||
176 | <tbody> | ||
177 | <tr class="<?php echo ($php_ok) ? 'enabled' : 'disabled'; ?>"> | ||
178 | <td>PHP</td> | ||
179 | <td>5.2.0 or higher</td> | ||
180 | <td><?php echo phpversion(); ?></td> | ||
181 | </tr> | ||
182 | <tr class="<?php echo ($xml_ok) ? 'enabled, and sane' : 'disabled, or broken'; ?>"> | ||
183 | <td><a href="http://php.net/xml">XML</a></td> | ||
184 | <td>Enabled</td> | ||
185 | <td><?php echo ($xml_ok) ? 'Enabled, and sane' : 'Disabled, or broken'; ?></td> | ||
186 | </tr> | ||
187 | <tr class="<?php echo ($pcre_ok) ? 'enabled' : 'disabled'; ?>"> | ||
188 | <td><a href="http://php.net/pcre">PCRE</a></td> | ||
189 | <td>Enabled</td> | ||
190 | <td><?php echo ($pcre_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
191 | </tr> | ||
192 | <!-- <tr class="<?php echo ($zlib_ok) ? 'enabled' : 'disabled'; ?>"> | ||
193 | <td><a href="http://php.net/zlib">Zlib</a></td> | ||
194 | <td>Enabled</td> | ||
195 | <td><?php echo ($zlib_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
196 | </tr> --> | ||
197 | <!-- <tr class="<?php echo ($mbstring_ok) ? 'enabled' : 'disabled'; ?>"> | ||
198 | <td><a href="http://php.net/mbstring">mbstring</a></td> | ||
199 | <td>Enabled</td> | ||
200 | <td><?php echo ($mbstring_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
201 | </tr> --> | ||
202 | <!-- <tr class="<?php echo ($iconv_ok) ? 'enabled' : 'disabled'; ?>"> | ||
203 | <td><a href="http://php.net/iconv">iconv</a></td> | ||
204 | <td>Enabled</td> | ||
205 | <td><?php echo ($iconv_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
206 | </tr> --> | ||
207 | <tr class="<?php echo ($filter_ok) ? 'enabled' : 'disabled'; ?>"> | ||
208 | <td><a href="http://uk.php.net/manual/en/book.filter.php">Data filtering</a></td> | ||
209 | <td>Enabled</td> | ||
210 | <td><?php echo ($filter_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
211 | </tr> | ||
212 | <tr class="<?php echo ($tidy_ok) ? 'enabled' : 'disabled'; ?>"> | ||
213 | <td><a href="http://php.net/tidy">Tidy</a></td> | ||
214 | <td>Enabled</td> | ||
215 | <td><?php echo ($tidy_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
216 | </tr> | ||
217 | <tr class="<?php echo ($curl_ok) ? 'enabled' : 'disabled'; ?>"> | ||
218 | <td><a href="http://php.net/curl">cURL</a></td> | ||
219 | <td>Enabled</td> | ||
220 | <td><?php echo (extension_loaded('curl')) ? 'Enabled' : 'Disabled'; ?></td> | ||
221 | </tr> | ||
222 | <tr class="<?php echo ($parallel_ok) ? 'enabled' : 'disabled'; ?>"> | ||
223 | <td>Parallel URL fetching</td> | ||
224 | <td>Enabled</td> | ||
225 | <td><?php echo ($parallel_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
226 | </tr> | ||
227 | <tr class="<?php echo ($allow_url_fopen_ok) ? 'enabled' : 'disabled'; ?>"> | ||
228 | <td><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen">allow_url_fopen</a></td> | ||
229 | <td>Enabled</td> | ||
230 | <td><?php echo ($allow_url_fopen_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
231 | </tr> | ||
232 | </tbody> | ||
233 | </table> | ||
234 | </div> | ||
235 | |||
236 | <div class="chunk"> | ||
237 | <h3>What does this mean?</h3> | ||
238 | <ol> | ||
239 | <?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): ?> | ||
240 | <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $tidy_ok && $curl_ok && $parallel_ok && $allow_url_fopen_ok): ?> | ||
241 | <li><em>You have everything you need to run <?php echo $app_name; ?> properly! Congratulations!</em></li> | ||
242 | <?php else: ?> | ||
243 | <?php if ($php_ok): ?> | ||
244 | <li><strong>PHP:</strong> You are running a supported version of PHP. <em>No problems here.</em></li> | ||
245 | <?php if ($xml_ok): ?> | ||
246 | <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> | ||
247 | <?php if ($pcre_ok): ?> | ||
248 | <li><strong>PCRE:</strong> You have PCRE support installed. <em>No problems here.</em></li> | ||
249 | |||
250 | <?php if ($allow_url_fopen_ok): ?> | ||
251 | <li><strong>allow_url_fopen:</strong> You have allow_url_fopen enabled. <em>No problems here.</em></li> | ||
252 | |||
253 | <?php if ($filter_ok): ?> | ||
254 | <li><strong>Data filtering:</strong> You have the PHP filter extension enabled. <em>No problems here.</em></li> | ||
255 | |||
256 | <?php if ($zlib_ok): ?> | ||
257 | <li><strong>Zlib:</strong> You have <code>Zlib</code> enabled. This allows SimplePie to support GZIP-encoded feeds. <em>No problems here.</em></li> | ||
258 | <?php else: ?> | ||
259 | <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> | ||
260 | <?php endif; ?> | ||
261 | |||
262 | <?php if ($mbstring_ok && $iconv_ok): ?> | ||
263 | <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> | ||
264 | <?php elseif ($mbstring_ok): ?> | ||
265 | <li><strong>mbstring:</strong> <code>mbstring</code> is installed, but <code>iconv</code> is not.</li> | ||
266 | <?php elseif ($iconv_ok): ?> | ||
267 | <li><strong>iconv:</strong> <code>iconv</code> is installed, but <code>mbstring</code> is not.</li> | ||
268 | <?php else: ?> | ||
269 | <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> | ||
270 | <?php endif; ?> | ||
271 | |||
272 | <?php if ($tidy_ok): ?> | ||
273 | <li><strong>Tidy:</strong> You have <code>Tidy</code> support installed. <em>No problems here.</em></li> | ||
274 | <?php else: ?> | ||
275 | <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> | ||
276 | <?php endif; ?> | ||
277 | |||
278 | <?php if ($curl_ok): ?> | ||
279 | <li><strong>cURL:</strong> You have <code>cURL</code> support installed. <em>No problems here.</em></li> | ||
280 | <?php else: ?> | ||
281 | <li><strong>cURL:</strong> The <code>cURL</code> extension is not available. SimplePie will use <code>fsockopen()</code> instead.</li> | ||
282 | <?php endif; ?> | ||
283 | |||
284 | <?php if ($parallel_ok): ?> | ||
285 | <li><strong>Parallel URL fetching:</strong> You have <code>HttpRequestPool</code> or <code>curl_multi</code> support installed. <em>No problems here.</em></li> | ||
286 | <?php else: ?> | ||
287 | <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> | ||
288 | <?php endif; ?> | ||
289 | |||
290 | <?php else: ?> | ||
291 | <li><strong>Data filtering:</strong> Your PHP configuration has the filter extension disabled. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
292 | <?php endif; ?> | ||
293 | |||
294 | <?php else: ?> | ||
295 | <li><strong>allow_url_fopen:</strong> Your PHP configuration has allow_url_fopen disabled. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
296 | <?php endif; ?> | ||
297 | |||
298 | <?php else: ?> | ||
299 | <li><strong>PCRE:</strong> Your PHP installation doesn't support Perl-Compatible Regular Expressions. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
300 | <?php endif; ?> | ||
301 | <?php else: ?> | ||
302 | <li><strong>XML:</strong> Your PHP installation doesn't support XML parsing. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
303 | <?php endif; ?> | ||
304 | <?php else: ?> | ||
305 | <li><strong>PHP:</strong> You are running an unsupported version of PHP. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
306 | <?php endif; ?> | ||
307 | <?php endif; ?> | ||
308 | </ol> | ||
309 | </div> | ||
310 | |||
311 | <div class="chunk"> | ||
312 | <?php //if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $iconv_ok && $filter_ok && $allow_url_fopen_ok) { ?> | ||
313 | <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $allow_url_fopen_ok) { ?> | ||
314 | <h3>Bottom Line: Yes, you can!</h3> | ||
315 | <p><em>Your webhost has its act together!</em></p> | ||
316 | <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p> | ||
317 | <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost — it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p> | ||
318 | <?php //} else if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $allow_url_fopen_ok && $filter_ok) { ?> | ||
319 | <?php } else if ($php_ok && $xml_ok && $pcre_ok && $allow_url_fopen_ok && $filter_ok) { ?> | ||
320 | <h3>Bottom Line: Yes, you can!</h3> | ||
321 | <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> | ||
322 | <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p> | ||
323 | <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost — it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p> | ||
324 | <?php } else { ?> | ||
325 | <h3>Bottom Line: We're sorry…</h3> | ||
326 | <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> | ||
327 | <?php } ?> | ||
328 | </div> | ||
329 | |||
330 | <div class="chunk"> | ||
331 | <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> | ||
332 | </div> | ||
333 | |||
334 | </div> | ||
335 | |||
336 | </div> | ||
337 | |||
338 | </body> | ||
339 | </html> \ No newline at end of file | ||