Go to the documentation of this file.
61 $class =
'ExternalStore' . ucfirst( $proto );
64 return class_exists( $class ) ?
new $class(
$params ) :
false;
76 $parts = explode(
'://', $url, 2 );
77 if (
count( $parts ) != 2 ) {
87 if ( $store ===
false ) {
91 return $store->fetchFromURL( $url );
103 foreach ( $urls
as $url ) {
104 $scheme = parse_url( $url, PHP_URL_SCHEME );
106 $batches[$scheme][] = $url;
110 foreach ( $batches
as $proto => $batchedUrls ) {
112 if ( $store ===
false ) {
115 $retval += $store->batchFetchFromURLs( $batchedUrls );
118 $missing = array_diff( $urls, array_keys(
$retval ) );
120 foreach ( $missing
as $url ) {
140 $parts = explode(
'://', $url, 2 );
141 if (
count( $parts ) != 2 ) {
151 if ( $store ===
false ) {
154 return $store->store(
$path, $data );
189 while (
count( $tryStores ) > 0 ) {
190 $index = mt_rand( 0,
count( $tryStores ) - 1 );
191 $storeUrl = $tryStores[$index];
192 wfDebug( __METHOD__ .
": trying $storeUrl\n" );
193 list( $proto,
$path ) = explode(
'://', $storeUrl, 2 );
195 if ( $store ===
false ) {
196 throw new MWException(
"Invalid external storage protocol - $storeUrl" );
199 $url = $store->store(
$path, $data );
200 }
catch ( Exception $error ) {
203 if ( strlen( $url ) ) {
206 unset( $tryStores[$index] );
207 $tryStores = array_values( $tryStores );
209 "Unable to store text to external storage $storeUrl" );
216 throw new MWException(
"Unable to store text to external storage" );
static insertToDefault( $data, array $params=[])
Like insert() above, but does more of the work for us.
$wgExternalStores
External stores allow including content from non database sources following URL links.
static fetchFromURL( $url, array $params=[])
Fetch data from given URL.
static insertWithFallback(array $tryStores, $data, array $params=[])
Like insert() above, but does more of the work for us.
array $wgDefaultExternalStore
The place to put new revisions, false to put them in the local text table.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Constructor class for key/value blob data kept in external repositories.
when a variable name is used in a it is silently declared as a new masking the global
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
static getStoreObject( $proto, array $params=[])
Get an external store object of the given type, with the given parameters.
static insert( $url, $data, array $params=[])
Store a data item to an external store, identified by a partial URL The protocol part is used to iden...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static batchFetchFromURLs(array $urls)
Fetch data from multiple URLs with a minimum of round trips.
static insertToForeignDefault( $data, $wiki)
the array() calling protocol came about after MediaWiki 1.4rc1.