3 * Constructor class for data kept in external repositories
5 * External repositories might be populated by maintenance/async
6 * scripts, thus partial moving of data may be possible, as well
7 * as possibility to have any storage format (i.e. for archives)
11 /* Fetch data from given URL */
12 static function fetchFromURL($url) {
13 global $wgExternalStores;
15 if (!$wgExternalStores)
18 @list
($proto,$path)=explode('://',$url,2);
23 $store =& ExternalStore
::getStoreObject( $proto );
24 if ( $store === false )
26 return $store->fetchFromURL($url);
30 * Get an external store object of the given type
32 static function &getStoreObject( $proto ) {
33 global $wgExternalStores;
34 if (!$wgExternalStores)
36 /* Protocol not enabled */
37 if (!in_array( $proto, $wgExternalStores ))
40 $class='ExternalStore'.ucfirst($proto);
41 /* Any custom modules should be added to $wgAutoLoadClasses for on-demand loading */
42 if (!class_exists($class)) {
50 * Store a data item to an external store, identified by a partial URL
51 * The protocol part is used to identify the class, the rest is passed to the
52 * class itself as a parameter.
53 * Returns the URL of the stored data item, or false on error
55 static function insert( $url, $data ) {
56 list( $proto, $params ) = explode( '://', $url, 2 );
57 $store =& ExternalStore
::getStoreObject( $proto );
58 if ( $store === false ) {
61 return $store->store( $params, $data );