MediaWiki fundraising/REL1_35
ExternalStoreFactory Class Reference
Inheritance diagram for ExternalStoreFactory:
Collaboration diagram for ExternalStoreFactory:

Public Member Functions

 __construct (array $externalStores, array $defaultStores, $localDomainId, LoggerInterface $logger=null)
 
 getProtocols ()
 
 getStore ( $proto, array $params=[])
 Get an external store object of the given type, with the given parameters.
 
 getStoreForUrl ( $url, array $params=[])
 Get the ExternalStoreMedium for a given URL.
 
 getStoreLocationFromUrl ( $url)
 Get the location within the appropriate store for a given a URL.
 
 getUrlsByProtocol (array $urls)
 
 getWriteBaseUrls ()
 
 setLogger (LoggerInterface $logger)
 

Static Private Member Functions

static splitStorageUrl ( $storeUrl)
 

Private Attributes

string $localDomainId
 Default database domain to store content under.
 
LoggerInterface $logger
 
string[] $protocols
 List of storage access protocols.
 
string[] $writeBaseUrls
 List of base storage URLs that define locations for writes.
 

Detailed Description

Definition at line 15 of file ExternalStoreFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ExternalStoreFactory::__construct ( array $externalStores,
array $defaultStores,
$localDomainId,
LoggerInterface $logger = null )
Parameters
string[]$externalStoresSee $wgExternalStores
string[]$defaultStoresSee $wgDefaultExternalStore
string$localDomainIdLocal database/wiki ID
LoggerInterface | null$logger

Definition at line 31 of file ExternalStoreFactory.php.

Member Function Documentation

◆ getProtocols()

ExternalStoreFactory::getProtocols ( )
Returns
string[] List of active store types/protocols (lowercased), e.g. [ "db" ]
Since
1.34

Definition at line 53 of file ExternalStoreFactory.php.

◆ getStore()

ExternalStoreFactory::getStore ( $proto,
array $params = [] )

Get an external store object of the given type, with the given parameters.

The 'domain' field in $params will be set to the local DB domain if it is unset or false. A special 'isDomainImplicit' flag is set when this happens, which should only be used to handle legacy DB domain configuration concerns (e.g. T200471).

Parameters
string$protoType of external storage, should be a value in $wgExternalStores
array$paramsMap of ExternalStoreMedium::__construct context parameters.
Returns
ExternalStoreMedium The store class or false on error
Exceptions
ExternalStoreExceptionWhen $proto is not recognized

Definition at line 77 of file ExternalStoreFactory.php.

Referenced by getStoreForUrl().

◆ getStoreForUrl()

ExternalStoreFactory::getStoreForUrl ( $url,
array $params = [] )

Get the ExternalStoreMedium for a given URL.

$url is either of the form:

  • a) "<proto>://<location>/<path>", for retrieval, or
  • b) "<proto>://<location>", for storage
Parameters
string$url
array$paramsMap of ExternalStoreMedium::__construct context parameters
Returns
ExternalStoreMedium
Exceptions
ExternalStoreExceptionWhen the protocol is missing or not recognized
Since
1.34

Definition at line 121 of file ExternalStoreFactory.php.

References $path, and getStore().

◆ getStoreLocationFromUrl()

ExternalStoreFactory::getStoreLocationFromUrl ( $url)

Get the location within the appropriate store for a given a URL.

Parameters
string$url
Returns
string
Exceptions
ExternalStoreException
Since
1.34

Definition at line 138 of file ExternalStoreFactory.php.

◆ getUrlsByProtocol()

ExternalStoreFactory::getUrlsByProtocol ( array $urls)
Parameters
string[]$urls
Returns
array[] Map of (protocol => list of URLs)
Exceptions
ExternalStoreException
Since
1.34

Definition at line 153 of file ExternalStoreFactory.php.

◆ getWriteBaseUrls()

ExternalStoreFactory::getWriteBaseUrls ( )
Returns
string[] List of default base URLs for writes, e.g. [ "DB://cluster1" ]
Since
1.34

Definition at line 61 of file ExternalStoreFactory.php.

◆ setLogger()

ExternalStoreFactory::setLogger ( LoggerInterface $logger)

Definition at line 45 of file ExternalStoreFactory.php.

◆ splitStorageUrl()

static ExternalStoreFactory::splitStorageUrl ( $storeUrl)
staticprivate
Parameters
string$storeUrl
Returns
string[] (protocol, store location or location-qualified path)
Exceptions
ExternalStoreException

Definition at line 168 of file ExternalStoreFactory.php.

Member Data Documentation

◆ $localDomainId

string ExternalStoreFactory::$localDomainId
private

Default database domain to store content under.

Definition at line 21 of file ExternalStoreFactory.php.

◆ $logger

LoggerInterface ExternalStoreFactory::$logger
private

Definition at line 23 of file ExternalStoreFactory.php.

◆ $protocols

string [] ExternalStoreFactory::$protocols
private

List of storage access protocols.

Definition at line 17 of file ExternalStoreFactory.php.

◆ $writeBaseUrls

string [] ExternalStoreFactory::$writeBaseUrls
private

List of base storage URLs that define locations for writes.

Definition at line 19 of file ExternalStoreFactory.php.


The documentation for this class was generated from the following file: