MediaWiki REL1_35
ExternalStoreMemory Class Reference

Process memory based external objects for testing. More...

Inheritance diagram for ExternalStoreMemory:
Collaboration diagram for ExternalStoreMemory:

Public Member Functions

 __construct (array $params)
 
 batchFetchFromURLs (array $urls)
 Fetch data from given external store URLs.
 
 clear ()
 Remove all data from memory for this domain.
 
 fetchFromURL ( $url)
 Fetch data from given external store URL.
 
 store ( $location, $data)
 Insert a data item into a given location.
 
- Public Member Functions inherited from ExternalStoreMedium
 isReadOnly ( $location)
 Check if a given location is read-only.
 
 setLogger (LoggerInterface $logger)
 

Private Member Functions

 getURLComponents ( $url)
 

Static Private Attributes

static array[] $data = []
 Map of (location => DB domain => id => value)
 
static int $nextId = 0
 

Additional Inherited Members

- Protected Attributes inherited from ExternalStoreMedium
string $dbDomain
 Default database domain to store content under.
 
bool $isDbDomainExplicit
 Whether this was factoried with an explicit DB domain.
 
LoggerInterface $logger
 
array $params = []
 Usage context options for this instance.
 

Detailed Description

Process memory based external objects for testing.

In this system, each store "location" is separate PHP array. URLs are of the form "memory://location/id". The id/value pairs at each location are segregated by DB domain ID.

Since
1.33

Definition at line 33 of file ExternalStoreMemory.php.

Constructor & Destructor Documentation

◆ __construct()

ExternalStoreMemory::__construct ( array  $params)
Parameters
array$paramsUsage context options for this instance:
  • domain: the DB domain ID of the wiki the content is for [required]
  • logger: LoggerInterface instance [optional]
  • isDomainImplicit: whether this was factoried without an explicit DB domain [optional]

Reimplemented from ExternalStoreMedium.

Definition at line 39 of file ExternalStoreMemory.php.

References ExternalStoreMedium\$params.

Member Function Documentation

◆ batchFetchFromURLs()

ExternalStoreMemory::batchFetchFromURLs ( array  $urls)

Fetch data from given external store URLs.

Parameters
array$urlsA list of external store URLs
Returns
string[] Map of (url => text) for the URLs where data was actually found

Reimplemented from ExternalStoreMedium.

Definition at line 52 of file ExternalStoreMemory.php.

References $blob, and fetchFromURL().

◆ clear()

ExternalStoreMemory::clear ( )

Remove all data from memory for this domain.

Definition at line 74 of file ExternalStoreMemory.php.

◆ fetchFromURL()

ExternalStoreMemory::fetchFromURL (   $url)

Fetch data from given external store URL.

Parameters
string$urlAn external store URL
Returns
string|bool The text stored or false on error
Exceptions
MWException

Reimplemented from ExternalStoreMedium.

Definition at line 43 of file ExternalStoreMemory.php.

References ExternalStoreMedium\$dbDomain, and getURLComponents().

Referenced by batchFetchFromURLs().

◆ getURLComponents()

ExternalStoreMemory::getURLComponents (   $url)
private
Parameters
string$url
Returns
array (location, ID or null)

Definition at line 87 of file ExternalStoreMemory.php.

References $path.

Referenced by fetchFromURL().

◆ store()

ExternalStoreMemory::store (   $location,
  $data 
)

Insert a data item into a given location.

Parameters
string$locationThe location name
string$dataThe data item
Returns
string|bool The URL of the stored data item, or false on error
Exceptions
MWException

Reimplemented from ExternalStoreMedium.

Definition at line 64 of file ExternalStoreMemory.php.

References $data, ExternalStoreMedium\$dbDomain, and $nextId.

Member Data Documentation

◆ $data

array [] ExternalStoreMemory::$data = []
staticprivate

Map of (location => DB domain => id => value)

Definition at line 35 of file ExternalStoreMemory.php.

Referenced by store().

◆ $nextId

int ExternalStoreMemory::$nextId = 0
staticprivate

Definition at line 37 of file ExternalStoreMemory.php.

Referenced by store().


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