* Rewrote showEXIFdata() to use addWikiText() instead of addHTML()
[lhc/web/wiklou.git] / includes / ExternalStore.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 *
6 * Constructor class for data kept in external repositories
7 *
8 * External repositories might be populated by maintenance/async
9 * scripts, thus partial moving of data may be possible, as well
10 * as possibility to have any storage format (i.e. for archives)
11 *
12 */
13
14 class ExternalStore {
15 /* Fetch data from given URL */
16 function fetchFromURL($url) {
17 global $wgExternalStores;
18
19 if (!$wgExternalStores)
20 return false;
21
22 @list($proto,$path)=explode('://',$url,2);
23 /* Bad URL */
24 if ($path=="")
25 return false;
26 /* Protocol not enabled */
27 if (!in_array( $proto, $wgExternalStores ))
28 return false;
29
30 $class='ExternalStore'.ucfirst($proto);
31 /* Preloaded modules might exist, especially ones serving multiple protocols */
32 if (!class_exists($class)) {
33 if (!include_once($class.'.php'))
34 return false;
35 }
36 $store=new $class();
37 return $store->fetchFromURL($url);
38 }
39
40 /* XXX: may require other methods, for store, delete,
41 * whatever, for initial ext storage
42 */
43 }
44 ?>