diff options
author | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-25 12:40:16 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-25 12:40:16 +0200 |
commit | 6fa7d088604665b887faf342e3bef1d599b916b4 (patch) | |
tree | 301a1ea1a7680496f60d5ea2ae7b30c910a6d48f /poche_compatibility_test.php | |
parent | 3044b21eb6db408c1e1981731040391829c80c22 (diff) | |
download | wallabag-6fa7d088604665b887faf342e3bef1d599b916b4.tar.gz wallabag-6fa7d088604665b887faf342e3bef1d599b916b4.tar.zst wallabag-6fa7d088604665b887faf342e3bef1d599b916b4.zip |
poche compatibility test file
Diffstat (limited to 'poche_compatibility_test.php')
-rw-r--r-- | poche_compatibility_test.php | 353 |
1 files changed, 353 insertions, 0 deletions
diff --git a/poche_compatibility_test.php b/poche_compatibility_test.php new file mode 100644 index 00000000..7c85a583 --- /dev/null +++ b/poche_compatibility_test.php | |||
@@ -0,0 +1,353 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | FULL-TEXT-RSS V2 COMPATIBILITY TEST | ||
4 | |||
5 | 1) Upload ftr_compatibility_test.php to the web-accessible root of your website. | ||
6 | For example, if your website is www.example.com, upload it so that you can get | ||
7 | to it at www.example.com/ftr_compatibility_test.php | ||
8 | |||
9 | 2) Open your web browser and go to the page you just uploaded. | ||
10 | |||
11 | Note: This compatibility test has been borrowed (and slightly adapted) from the one supplied by | ||
12 | SimplePie.org. We have kept most of their checks intact as we use SimplePie in our application. | ||
13 | http://github.com/simplepie/simplepie/tree/master/compatibility_test/ | ||
14 | */ | ||
15 | |||
16 | $app_name = 'poche 1.0'; | ||
17 | |||
18 | $php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.2.0', '>=')); | ||
19 | $pcre_ok = extension_loaded('pcre'); | ||
20 | $zlib_ok = extension_loaded('zlib'); | ||
21 | $mbstring_ok = extension_loaded('mbstring'); | ||
22 | $iconv_ok = extension_loaded('iconv'); | ||
23 | $tidy_ok = function_exists('tidy_parse_string'); | ||
24 | $curl_ok = function_exists('curl_exec'); | ||
25 | $parallel_ok = ((extension_loaded('http') && class_exists('HttpRequestPool')) || ($curl_ok && function_exists('curl_multi_init'))); | ||
26 | $allow_url_fopen_ok = (bool)ini_get('allow_url_fopen'); | ||
27 | $filter_ok = extension_loaded('filter'); | ||
28 | |||
29 | if (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>&</foo>', $values); | ||
34 | xml_parser_free($parser_check); | ||
35 | $xml_ok = isset($values[0]['value']); | ||
36 | } else { | ||
37 | $xml_ok = false; | ||
38 | } | ||
39 | |||
40 | header('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"> | ||
49 | body { | ||
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 | |||
58 | div#site { | ||
59 | width:550px; | ||
60 | margin:20px auto 0 auto; | ||
61 | } | ||
62 | |||
63 | a { | ||
64 | color:#000; | ||
65 | text-decoration:underline; | ||
66 | padding:0 1px; | ||
67 | } | ||
68 | |||
69 | a:hover { | ||
70 | color:#fff; | ||
71 | background-color:#333; | ||
72 | text-decoration:none; | ||
73 | padding:0 1px; | ||
74 | } | ||
75 | |||
76 | p { | ||
77 | margin:0; | ||
78 | padding:5px 0; | ||
79 | } | ||
80 | |||
81 | em { | ||
82 | font-style:normal; | ||
83 | background-color:#ffc; | ||
84 | padding: 0.1em 0; | ||
85 | } | ||
86 | |||
87 | ul, ol { | ||
88 | margin:10px 0 10px 20px; | ||
89 | padding:0 0 0 15px; | ||
90 | } | ||
91 | |||
92 | ul li, ol li { | ||
93 | margin:0 0 7px 0; | ||
94 | padding:0 0 0 3px; | ||
95 | } | ||
96 | |||
97 | h2 { | ||
98 | font-size:18px; | ||
99 | padding:0; | ||
100 | margin:30px 0 20px 0; | ||
101 | } | ||
102 | |||
103 | h3 { | ||
104 | font-size:16px; | ||
105 | padding:0; | ||
106 | margin:20px 0 5px 0; | ||
107 | } | ||
108 | |||
109 | h4 { | ||
110 | font-size:14px; | ||
111 | padding:0; | ||
112 | margin:15px 0 5px 0; | ||
113 | } | ||
114 | |||
115 | code { | ||
116 | font-size:1.1em; | ||
117 | background-color:#f3f3ff; | ||
118 | color:#000; | ||
119 | } | ||
120 | |||
121 | em strong { | ||
122 | text-transform: uppercase; | ||
123 | } | ||
124 | |||
125 | table#chart { | ||
126 | border-collapse:collapse; | ||
127 | } | ||
128 | |||
129 | table#chart th { | ||
130 | background-color:#eee; | ||
131 | padding:2px 3px; | ||
132 | border:1px solid #fff; | ||
133 | } | ||
134 | |||
135 | table#chart td { | ||
136 | text-align:center; | ||
137 | padding:2px 3px; | ||
138 | border:1px solid #eee; | ||
139 | } | ||
140 | |||
141 | table#chart tr.enabled td { | ||
142 | /* Leave this alone */ | ||
143 | } | ||
144 | |||
145 | table#chart tr.disabled td, | ||
146 | table#chart tr.disabled td a { | ||
147 | color:#999; | ||
148 | font-style:italic; | ||
149 | } | ||
150 | |||
151 | table#chart tr.disabled td a { | ||
152 | text-decoration:underline; | ||
153 | } | ||
154 | |||
155 | div.chunk { | ||
156 | margin:20px 0 0 0; | ||
157 | padding:0 0 10px 0; | ||
158 | border-bottom:1px solid #ccc; | ||
159 | } | ||
160 | |||
161 | .footnote, | ||
162 | .footnote a { | ||
163 | font:10px/12px verdana, sans-serif; | ||
164 | color:#aaa; | ||
165 | } | ||
166 | |||
167 | .footnote em { | ||
168 | background-color:transparent; | ||
169 | font-style:italic; | ||
170 | } | ||
171 | </style> | ||
172 | |||
173 | </head> | ||
174 | |||
175 | <body> | ||
176 | |||
177 | <div id="site"> | ||
178 | <div id="content"> | ||
179 | |||
180 | <div class="chunk"> | ||
181 | <h2 style="text-align:center;"><?php echo $app_name; ?>: Compatibility Test</h2> | ||
182 | <table cellpadding="0" cellspacing="0" border="0" width="100%" id="chart"> | ||
183 | <thead> | ||
184 | <tr> | ||
185 | <th>Test</th> | ||
186 | <th>Should Be</th> | ||
187 | <th>What You Have</th> | ||
188 | </tr> | ||
189 | </thead> | ||
190 | <tbody> | ||
191 | <tr class="<?php echo ($php_ok) ? 'enabled' : 'disabled'; ?>"> | ||
192 | <td>PHP</td> | ||
193 | <td>5.2.0 or higher</td> | ||
194 | <td><?php echo phpversion(); ?></td> | ||
195 | </tr> | ||
196 | <tr class="<?php echo ($xml_ok) ? 'enabled, and sane' : 'disabled, or broken'; ?>"> | ||
197 | <td><a href="http://php.net/xml">XML</a></td> | ||
198 | <td>Enabled</td> | ||
199 | <td><?php echo ($xml_ok) ? 'Enabled, and sane' : 'Disabled, or broken'; ?></td> | ||
200 | </tr> | ||
201 | <tr class="<?php echo ($pcre_ok) ? 'enabled' : 'disabled'; ?>"> | ||
202 | <td><a href="http://php.net/pcre">PCRE</a></td> | ||
203 | <td>Enabled</td> | ||
204 | <td><?php echo ($pcre_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
205 | </tr> | ||
206 | <!-- <tr class="<?php echo ($zlib_ok) ? 'enabled' : 'disabled'; ?>"> | ||
207 | <td><a href="http://php.net/zlib">Zlib</a></td> | ||
208 | <td>Enabled</td> | ||
209 | <td><?php echo ($zlib_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
210 | </tr> --> | ||
211 | <!-- <tr class="<?php echo ($mbstring_ok) ? 'enabled' : 'disabled'; ?>"> | ||
212 | <td><a href="http://php.net/mbstring">mbstring</a></td> | ||
213 | <td>Enabled</td> | ||
214 | <td><?php echo ($mbstring_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
215 | </tr> --> | ||
216 | <!-- <tr class="<?php echo ($iconv_ok) ? 'enabled' : 'disabled'; ?>"> | ||
217 | <td><a href="http://php.net/iconv">iconv</a></td> | ||
218 | <td>Enabled</td> | ||
219 | <td><?php echo ($iconv_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
220 | </tr> --> | ||
221 | <tr class="<?php echo ($filter_ok) ? 'enabled' : 'disabled'; ?>"> | ||
222 | <td><a href="http://uk.php.net/manual/en/book.filter.php">Data filtering</a></td> | ||
223 | <td>Enabled</td> | ||
224 | <td><?php echo ($filter_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
225 | </tr> | ||
226 | <tr class="<?php echo ($tidy_ok) ? 'enabled' : 'disabled'; ?>"> | ||
227 | <td><a href="http://php.net/tidy">Tidy</a></td> | ||
228 | <td>Enabled</td> | ||
229 | <td><?php echo ($tidy_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
230 | </tr> | ||
231 | <tr class="<?php echo ($curl_ok) ? 'enabled' : 'disabled'; ?>"> | ||
232 | <td><a href="http://php.net/curl">cURL</a></td> | ||
233 | <td>Enabled</td> | ||
234 | <td><?php echo (extension_loaded('curl')) ? 'Enabled' : 'Disabled'; ?></td> | ||
235 | </tr> | ||
236 | <tr class="<?php echo ($parallel_ok) ? 'enabled' : 'disabled'; ?>"> | ||
237 | <td>Parallel URL fetching</td> | ||
238 | <td>Enabled</td> | ||
239 | <td><?php echo ($parallel_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
240 | </tr> | ||
241 | <tr class="<?php echo ($allow_url_fopen_ok) ? 'enabled' : 'disabled'; ?>"> | ||
242 | <td><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen">allow_url_fopen</a></td> | ||
243 | <td>Enabled</td> | ||
244 | <td><?php echo ($allow_url_fopen_ok) ? 'Enabled' : 'Disabled'; ?></td> | ||
245 | </tr> | ||
246 | </tbody> | ||
247 | </table> | ||
248 | </div> | ||
249 | |||
250 | <div class="chunk"> | ||
251 | <h3>What does this mean?</h3> | ||
252 | <ol> | ||
253 | <?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): ?> | ||
254 | <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $tidy_ok && $curl_ok && $parallel_ok && $allow_url_fopen_ok): ?> | ||
255 | <li><em>You have everything you need to run <?php echo $app_name; ?> properly! Congratulations!</em></li> | ||
256 | <?php else: ?> | ||
257 | <?php if ($php_ok): ?> | ||
258 | <li><strong>PHP:</strong> You are running a supported version of PHP. <em>No problems here.</em></li> | ||
259 | <?php if ($xml_ok): ?> | ||
260 | <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> | ||
261 | <?php if ($pcre_ok): ?> | ||
262 | <li><strong>PCRE:</strong> You have PCRE support installed. <em>No problems here.</em></li> | ||
263 | |||
264 | <?php if ($allow_url_fopen_ok): ?> | ||
265 | <li><strong>allow_url_fopen:</strong> You have allow_url_fopen enabled. <em>No problems here.</em></li> | ||
266 | |||
267 | <?php if ($filter_ok): ?> | ||
268 | <li><strong>Data filtering:</strong> You have the PHP filter extension enabled. <em>No problems here.</em></li> | ||
269 | |||
270 | <?php if ($zlib_ok): ?> | ||
271 | <li><strong>Zlib:</strong> You have <code>Zlib</code> enabled. This allows SimplePie to support GZIP-encoded feeds. <em>No problems here.</em></li> | ||
272 | <?php else: ?> | ||
273 | <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> | ||
274 | <?php endif; ?> | ||
275 | |||
276 | <?php if ($mbstring_ok && $iconv_ok): ?> | ||
277 | <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> | ||
278 | <?php elseif ($mbstring_ok): ?> | ||
279 | <li><strong>mbstring:</strong> <code>mbstring</code> is installed, but <code>iconv</code> is not.</li> | ||
280 | <?php elseif ($iconv_ok): ?> | ||
281 | <li><strong>iconv:</strong> <code>iconv</code> is installed, but <code>mbstring</code> is not.</li> | ||
282 | <?php else: ?> | ||
283 | <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> | ||
284 | <?php endif; ?> | ||
285 | |||
286 | <?php if ($tidy_ok): ?> | ||
287 | <li><strong>Tidy:</strong> You have <code>Tidy</code> support installed. <em>No problems here.</em></li> | ||
288 | <?php else: ?> | ||
289 | <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> | ||
290 | <?php endif; ?> | ||
291 | |||
292 | <?php if ($curl_ok): ?> | ||
293 | <li><strong>cURL:</strong> You have <code>cURL</code> support installed. <em>No problems here.</em></li> | ||
294 | <?php else: ?> | ||
295 | <li><strong>cURL:</strong> The <code>cURL</code> extension is not available. SimplePie will use <code>fsockopen()</code> instead.</li> | ||
296 | <?php endif; ?> | ||
297 | |||
298 | <?php if ($parallel_ok): ?> | ||
299 | <li><strong>Parallel URL fetching:</strong> You have <code>HttpRequestPool</code> or <code>curl_multi</code> support installed. <em>No problems here.</em></li> | ||
300 | <?php else: ?> | ||
301 | <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> | ||
302 | <?php endif; ?> | ||
303 | |||
304 | <?php else: ?> | ||
305 | <li><strong>Data filtering:</strong> Your PHP configuration has the filter extension disabled. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
306 | <?php endif; ?> | ||
307 | |||
308 | <?php else: ?> | ||
309 | <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> | ||
310 | <?php endif; ?> | ||
311 | |||
312 | <?php else: ?> | ||
313 | <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> | ||
314 | <?php endif; ?> | ||
315 | <?php else: ?> | ||
316 | <li><strong>XML:</strong> Your PHP installation doesn't support XML parsing. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
317 | <?php endif; ?> | ||
318 | <?php else: ?> | ||
319 | <li><strong>PHP:</strong> You are running an unsupported version of PHP. <em><?php echo $app_name; ?> will not work here.</em></li> | ||
320 | <?php endif; ?> | ||
321 | <?php endif; ?> | ||
322 | </ol> | ||
323 | </div> | ||
324 | |||
325 | <div class="chunk"> | ||
326 | <?php //if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $iconv_ok && $filter_ok && $allow_url_fopen_ok) { ?> | ||
327 | <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $allow_url_fopen_ok) { ?> | ||
328 | <h3>Bottom Line: Yes, you can!</h3> | ||
329 | <p><em>Your webhost has its act together!</em></p> | ||
330 | <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://inthepoche.com/download">inthepoche.com</a>.</p> | ||
331 | <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> | ||
332 | <?php //} else if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $allow_url_fopen_ok && $filter_ok) { ?> | ||
333 | <?php } else if ($php_ok && $xml_ok && $pcre_ok && $allow_url_fopen_ok && $filter_ok) { ?> | ||
334 | <h3>Bottom Line: Yes, you can!</h3> | ||
335 | <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> | ||
336 | <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://inthepoche.com/download">inthepoche.com</a>.</p> | ||
337 | <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> | ||
338 | <?php } else { ?> | ||
339 | <h3>Bottom Line: We're sorry…</h3> | ||
340 | <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> | ||
341 | <?php } ?> | ||
342 | </div> | ||
343 | |||
344 | <div class="chunk"> | ||
345 | <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> | ||
346 | </div> | ||
347 | |||
348 | </div> | ||
349 | |||
350 | </div> | ||
351 | |||
352 | </body> | ||
353 | </html> \ No newline at end of file | ||