MediaWiki REL1_31
|
Service for storing and loading Content objects. More...
Public Member Functions | |
__construct (LoadBalancer $dbLoadBalancer, WANObjectCache $cache, $wikiId=false) | |
compressData (&$blob) | |
If $wgCompressRevisions is enabled, we will compress data. | |
decompressData ( $blob, array $blobFlags) | |
Re-converts revision text according to its flags. | |
expandBlob ( $raw, $flags, $cacheKey=null) | |
Expand a raw data blob according to the flags given. | |
getBlob ( $blobAddress, $queryFlags=0) | |
Retrieve a blob, given an address. | |
getCacheExpiry () | |
getCompressBlobs () | |
getLegacyEncoding () | |
getLegacyEncodingConversionLang () | |
getTextIdFromAddress ( $address) | |
Returns an ID corresponding to the old_id field in the text table, corresponding to the given $address. | |
getUseExternalStore () | |
isReadOnly () | |
Check if the blob metadata or backing blob data store is read-only. | |
setCacheExpiry ( $cacheExpiry) | |
setCompressBlobs ( $compressBlobs) | |
setLegacyEncoding ( $legacyEncoding, Language $language) | |
setUseExternalStore ( $useExternalStore) | |
storeBlob ( $data, $hints=[]) | |
Stores an arbitrary blob of data and returns an address that can be used with getBlob() to retrieve the same blob of data,. | |
Public Attributes | |
const | TEXT_CACHE_GROUP = 'revisiontext:10' |
Public Attributes inherited from IDBAccessObject | |
const | READ_LOCKING = 3 |
Constants for object loading bitfield flags (higher => higher QoS) | |
const | READ_NONE = -1 |
Public Attributes inherited from MediaWiki\Storage\BlobStore | |
const | DESIGNATION_HINT = 'designation' |
Hint key for use with storeBlob, indicating the general role the block takes in the application. | |
const | FORMAT_HINT = 'cont_format' |
Hint key for use with storeBlob, indicating the serialization format used to create the blob, as a MIME type. | |
const | MODEL_HINT = 'cont_model' |
Hint key for use with storeBlob, indicating the model of the content encoded in the given blob. | |
const | PAGE_HINT = 'page_id' |
Hint key for use with storeBlob, indicating the page the blob is associated with. | |
const | PARENT_HINT = 'rev_parent_id' |
Hint key for use with storeBlob, indicating the parent revision of the revision the blob is associated with. | |
const | REVISION_HINT = 'rev_id' |
Hint key for use with storeBlob, indicating the revision the blob is associated with. | |
const | ROLE_HINT = 'role_name' |
Hint key for use with storeBlob, indicating the slot the blob is associated with. | |
const | SHA1_HINT = 'cont_sha1' |
Hint key for use with storeBlob, providing the SHA1 hash of the blob as passed to the method. | |
Private Member Functions | |
fetchBlob ( $blobAddress, $queryFlags) | |
MCR migration note: this corresponds to Revision::fetchText. | |
getCacheTTL () | |
Get the text cache TTL. | |
getDBConnection ( $index) | |
getDBLoadBalancer () | |
Static Private Member Functions | |
static | splitBlobAddress ( $address) |
Splits a blob address into three parts: the schema, the ID, and parameters/flags. | |
Private Attributes | |
WANObjectCache | $cache |
int | $cacheExpiry = 604800 |
bool | $compressBlobs = false |
LoadBalancer | $dbLoadBalancer |
bool string | $legacyEncoding = false |
Language null | $legacyEncodingConversionLang = null |
boolean | $useExternalStore = false |
bool string | $wikiId |
Wiki ID. | |
Service for storing and loading Content objects.
Definition at line 50 of file SqlBlobStore.php.
MediaWiki\Storage\SqlBlobStore::__construct | ( | LoadBalancer | $dbLoadBalancer, |
WANObjectCache | $cache, | ||
$wikiId = false ) |
LoadBalancer | $dbLoadBalancer | A load balancer for acquiring database connections |
WANObjectCache | $cache | A cache manager for caching blobs |
bool | string | $wikiId | The ID of the target wiki database. Use false for the local wiki. |
Definition at line 100 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$cache, MediaWiki\Storage\SqlBlobStore\$dbLoadBalancer, MediaWiki\Storage\SqlBlobStore\$wikiId, and cache.
MediaWiki\Storage\SqlBlobStore::compressData | ( | & | $blob | ) |
If $wgCompressRevisions is enabled, we will compress data.
The input string is modified in place. Return value is the flags field: contains 'gzip' if the data is compressed, and 'utf-8' if we're saving in UTF-8 mode.
MCR migration note: this replaces Revision::compressRevisionText
mixed | &$blob | Reference to a text |
Definition at line 431 of file SqlBlobStore.php.
References $blob, wfDebug(), and wfLogWarning().
Referenced by MediaWiki\Storage\SqlBlobStore\storeBlob().
MediaWiki\Storage\SqlBlobStore::decompressData | ( | $blob, | |
array | $blobFlags ) |
Re-converts revision text according to its flags.
MCR migration note: this replaces Revision::decompressRevisionText
mixed | $blob | Reference to a text |
array | $blobFlags | Compression flags, such as 'gzip'. Note that not including 'utf-8' in $blobFlags will cause the data to be decoded according to the legacy encoding specified via setLegacyEncoding. |
Definition at line 471 of file SqlBlobStore.php.
References $blob, unserialize(), and wfLogWarning().
Referenced by MediaWiki\Storage\SqlBlobStore\expandBlob().
MediaWiki\Storage\SqlBlobStore::expandBlob | ( | $raw, | |
$flags, | |||
$cacheKey = null ) |
Expand a raw data blob according to the flags given.
MCR migration note: this replaces Revision::getRevisionText
string | $raw | The raw blob data, to be processed according to $flags. May be the blob itself, or the blob compressed, or just the address of the actual blob, depending on $flags. |
string | string[] | $flags | Blob flags, such as 'external' or 'gzip'. Note that not including 'utf-8' in $flags will cause the data to be decoded according to the legacy encoding specified via setLegacyEncoding. |
string | null | $cacheKey | May be used for caching if given |
Definition at line 377 of file SqlBlobStore.php.
References $blob, cache, MediaWiki\Storage\SqlBlobStore\decompressData(), ExternalStore\fetchFromURL(), function, and MediaWiki\Storage\SqlBlobStore\TEXT_CACHE_GROUP.
Referenced by MediaWiki\Storage\SqlBlobStore\fetchBlob().
|
private |
MCR migration note: this corresponds to Revision::fetchText.
string | $blobAddress | |
int | $queryFlags |
BlobAccessException |
Definition at line 298 of file SqlBlobStore.php.
References $blob, $options, MediaWiki\Storage\SqlBlobStore\expandBlob(), MediaWiki\Storage\SqlBlobStore\getDBConnection(), list, MediaWiki\Storage\SqlBlobStore\splitBlobAddress(), and wfWarn().
Referenced by MediaWiki\Storage\SqlBlobStore\getBlob().
MediaWiki\Storage\SqlBlobStore::getBlob | ( | $blobAddress, | |
$queryFlags = 0 ) |
Retrieve a blob, given an address.
Currently hardcoded to the 'text' table storage engine.
MCR migration note: this replaces Revision::loadText
string | $blobAddress | |
int | $queryFlags |
BlobAccessException |
Implements MediaWiki\Storage\BlobStore.
Definition at line 265 of file SqlBlobStore.php.
References $blob, cache, MediaWiki\Storage\SqlBlobStore\fetchBlob(), function, MediaWiki\Storage\SqlBlobStore\getDBConnection(), list, and MediaWiki\Storage\SqlBlobStore\TEXT_CACHE_GROUP.
MediaWiki\Storage\SqlBlobStore::getCacheExpiry | ( | ) |
Definition at line 113 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$cacheExpiry.
|
private |
Get the text cache TTL.
MCR migration note: this replaces Revision::getCacheTTL
Definition at line 525 of file SqlBlobStore.php.
References cache.
MediaWiki\Storage\SqlBlobStore::getCompressBlobs | ( | ) |
Definition at line 129 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$compressBlobs.
|
private |
int | $index | A database index, like DB_MASTER or DB_REPLICA |
Definition at line 196 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\getDBLoadBalancer().
Referenced by MediaWiki\Storage\SqlBlobStore\fetchBlob(), MediaWiki\Storage\SqlBlobStore\getBlob(), and MediaWiki\Storage\SqlBlobStore\storeBlob().
|
private |
Definition at line 187 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$dbLoadBalancer.
Referenced by MediaWiki\Storage\SqlBlobStore\getDBConnection(), and MediaWiki\Storage\SqlBlobStore\isReadOnly().
MediaWiki\Storage\SqlBlobStore::getLegacyEncoding | ( | ) |
Definition at line 144 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$legacyEncoding.
MediaWiki\Storage\SqlBlobStore::getLegacyEncodingConversionLang | ( | ) |
Definition at line 152 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$legacyEncodingConversionLang.
MediaWiki\Storage\SqlBlobStore::getTextIdFromAddress | ( | $address | ) |
Returns an ID corresponding to the old_id field in the text table, corresponding to the given $address.
Currently, $address must start with 'tt:' followed by a decimal integer representing the old_id; if $address does not start with 'tt:', null is returned. However, the implementation may change to insert rows into the text table on the fly.
string | $address |
Definition at line 557 of file SqlBlobStore.php.
References list, and MediaWiki\Storage\SqlBlobStore\splitBlobAddress().
MediaWiki\Storage\SqlBlobStore::getUseExternalStore | ( | ) |
Definition at line 171 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$useExternalStore.
MediaWiki\Storage\SqlBlobStore::isReadOnly | ( | ) |
Check if the blob metadata or backing blob data store is read-only.
Implements MediaWiki\Storage\BlobStore.
Definition at line 593 of file SqlBlobStore.php.
References ExternalStore\defaultStoresAreReadOnly(), and MediaWiki\Storage\SqlBlobStore\getDBLoadBalancer().
MediaWiki\Storage\SqlBlobStore::setCacheExpiry | ( | $cacheExpiry | ) |
int | $cacheExpiry | time for which blobs can be cached, in seconds |
Definition at line 120 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$cacheExpiry.
MediaWiki\Storage\SqlBlobStore::setCompressBlobs | ( | $compressBlobs | ) |
bool | $compressBlobs | whether blobs should be compressed for storage |
Definition at line 136 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$compressBlobs.
MediaWiki\Storage\SqlBlobStore::setLegacyEncoding | ( | $legacyEncoding, | |
Language | $language ) |
string | $legacyEncoding | The legacy encoding to assume for blobs that are not marked as utf8. |
Language | $language | The locale to use when decoding from a legacy encoding. |
Definition at line 161 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$legacyEncoding.
MediaWiki\Storage\SqlBlobStore::setUseExternalStore | ( | $useExternalStore | ) |
bool | $useExternalStore | Whether to use the ExternalStore mechanism for storing blobs. |
Definition at line 178 of file SqlBlobStore.php.
References MediaWiki\Storage\SqlBlobStore\$useExternalStore.
|
staticprivate |
Splits a blob address into three parts: the schema, the ID, and parameters/flags.
string | $address |
InvalidArgumentException |
Definition at line 581 of file SqlBlobStore.php.
References wfCgiToArray().
Referenced by MediaWiki\Storage\SqlBlobStore\fetchBlob(), and MediaWiki\Storage\SqlBlobStore\getTextIdFromAddress().
MediaWiki\Storage\SqlBlobStore::storeBlob | ( | $data, | |
$hints = [] ) |
Stores an arbitrary blob of data and returns an address that can be used with getBlob() to retrieve the same blob of data,.
string | $data | |
array | $hints | An array of hints. |
BlobAccessException |
Implements MediaWiki\Storage\BlobStore.
Definition at line 211 of file SqlBlobStore.php.
References $e, MediaWiki\Storage\SqlBlobStore\compressData(), DB_MASTER, MediaWiki\Storage\SqlBlobStore\getDBConnection(), and ExternalStore\insertToDefault().
|
private |
Definition at line 63 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\__construct().
|
private |
Definition at line 73 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\getCacheExpiry(), and MediaWiki\Storage\SqlBlobStore\setCacheExpiry().
|
private |
Definition at line 78 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\getCompressBlobs(), and MediaWiki\Storage\SqlBlobStore\setCompressBlobs().
|
private |
Definition at line 58 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\__construct(), and MediaWiki\Storage\SqlBlobStore\getDBLoadBalancer().
|
private |
Definition at line 83 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\getLegacyEncoding(), and MediaWiki\Storage\SqlBlobStore\setLegacyEncoding().
|
private |
Definition at line 88 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\getLegacyEncodingConversionLang().
|
private |
Definition at line 93 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\getUseExternalStore(), and MediaWiki\Storage\SqlBlobStore\setUseExternalStore().
|
private |
Wiki ID.
Definition at line 68 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\__construct().
const MediaWiki\Storage\SqlBlobStore::TEXT_CACHE_GROUP = 'revisiontext:10' |
Definition at line 53 of file SqlBlobStore.php.
Referenced by MediaWiki\Storage\SqlBlobStore\expandBlob(), and MediaWiki\Storage\SqlBlobStore\getBlob().