MediaWiki  1.34.0
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. More...
 
 getStoreForUrl ( $url, array $params=[])
 Get the ExternalStoreMedium for a given URL. More...
 
 getStoreLocationFromUrl ( $url)
 Get the location within the appropriate store for a given a URL. More...
 
 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. More...
 
LoggerInterface $logger
 
string[] $protocols
 List of storage access protocols. More...
 
string[] $writeBaseUrls
 List of base storage URLs that define locations for writes. More...
 

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.

References $localDomainId, and $logger.

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.

References $protocols.

◆ 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.

References $localDomainId, $logger, and FileBackendGroup\singleton().

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, getStore(), and splitStorageUrl().

◆ 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.

References splitStorageUrl().

◆ 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.

References splitStorageUrl().

◆ 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.

References $writeBaseUrls.

◆ setLogger()

ExternalStoreFactory::setLogger ( LoggerInterface  $logger)

Definition at line 45 of file ExternalStoreFactory.php.

References $logger.

◆ 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.

Referenced by getStoreForUrl(), getStoreLocationFromUrl(), and getUrlsByProtocol().

Member Data Documentation

◆ $localDomainId

string ExternalStoreFactory::$localDomainId
private

Default database domain to store content under.

Definition at line 21 of file ExternalStoreFactory.php.

Referenced by __construct(), and getStore().

◆ $logger

LoggerInterface ExternalStoreFactory::$logger
private

Definition at line 23 of file ExternalStoreFactory.php.

Referenced by __construct(), getStore(), and setLogger().

◆ $protocols

string [] ExternalStoreFactory::$protocols
private

List of storage access protocols.

Definition at line 17 of file ExternalStoreFactory.php.

Referenced by getProtocols().

◆ $writeBaseUrls

string [] ExternalStoreFactory::$writeBaseUrls
private

List of base storage URLs that define locations for writes.

Definition at line 19 of file ExternalStoreFactory.php.

Referenced by getWriteBaseUrls().


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