Second part of bug 4083: Special:Validation doesn't check wpEditToken
[mediawiki.git] / includes / ExternalStore.php
blob2c1fe3bacbff97422ea737457241cb3819d953c4
1 <?php
2 /**
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