MediaWiki master
ExternalStoreFactory Class Reference

Inherits LoggerAwareInterface.

Collaboration diagram for ExternalStoreFactory:

Public Member Functions

 __construct (array $externalStores, array $defaultStores, string $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)
 

Detailed Description

See also
ExternalStoreAccess
Access: internal
Use the ExternalStoreAccess service instead.
Since
1.31

Definition at line 14 of file ExternalStoreFactory.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 30 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 50 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 74 of file ExternalStoreFactory.php.

References $params.

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 122 of file ExternalStoreFactory.php.

References $params, $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 139 of file ExternalStoreFactory.php.

◆ getUrlsByProtocol()

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

Definition at line 154 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 58 of file ExternalStoreFactory.php.

◆ setLogger()

ExternalStoreFactory::setLogger ( LoggerInterface $logger)

Definition at line 42 of file ExternalStoreFactory.php.


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