* Don't show useless empty preview on new page creation
[mediawiki.git] / includes / ExternalStore.php
blob78e1b84d6e48823133d9371e9c3a348dd7588eea
1 <?php
2 /**
3 *
4 * @package MediaWiki
6 * Constructor class for data kept in external repositories
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)
14 class ExternalStore {
15 /* Fetch data from given URL */
16 function fetchFromURL($url) {
17 global $wgExternalStores;
19 if (!$wgExternalStores)
20 return false;
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;
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;
36 $store=new $class();
37 return $store->fetchFromURL($url);
40 /* XXX: may require other methods, for store, delete,
41 * whatever, for initial ext storage