Go to the documentation of this file.
39 list( $cluster, $id, $itemID ) = $this->
parseURL( $url );
42 if ( $itemID !==
false &&
$ret !==
false ) {
43 return $ret->getItem( $itemID );
59 $batched = $inverseUrlMap =
array();
60 foreach ( $urls
as $url ) {
61 list( $cluster, $id, $itemID ) = $this->
parseURL( $url );
62 $batched[$cluster][$id][] = $itemID;
65 $inverseUrlMap[$cluster][$id][$itemID] = $url;
68 foreach ( $batched
as $cluster => $batchByCluster ) {
72 foreach ( $batchByCluster[$id]
as $itemID ) {
73 $url = $inverseUrlMap[$cluster][$id][$itemID];
74 if ( $itemID ===
false ) {
89 public function store( $cluster, $data ) {
91 $id = $dbw->nextSequenceValue(
'blob_blob_id_seq' );
92 $dbw->insert( $this->
getTable( $dbw ),
93 array(
'blob_id' => $id,
'blob_text' => $data ),
95 $id = $dbw->insertId();
97 throw new MWException( __METHOD__ .
': no insert ID' );
99 if ( $dbw->getFlag(
DBO_TRX ) ) {
100 $dbw->commit( __METHOD__ );
103 return "DB://$cluster/$id";
113 $wiki = isset( $this->params[
'wiki'] ) ? $this->params[
'wiki'] :
false;
125 global $wgDefaultExternalStore;
127 $wiki = isset( $this->params[
'wiki'] ) ? $this->params[
'wiki'] :
false;
130 if ( !in_array(
"DB://" . $cluster, (
array)$wgDefaultExternalStore ) ) {
131 wfDebug(
"read only external store\n" );
132 $lb->allowLagged(
true );
134 wfDebug(
"writable external store\n" );
147 $wiki = isset( $this->params[
'wiki'] ) ? $this->params[
'wiki'] :
false;
160 $table = $db->getLBInfo(
'blobs table' );
161 if ( is_null( $table ) ) {
185 static $externalBlobCache =
array();
187 $cacheID = ( $itemID ===
false ) ?
"$cluster/$id" :
"$cluster/$id/";
188 if ( isset( $externalBlobCache[$cacheID] ) ) {
190 "ExternalStoreDB::fetchBlob cache hit on $cacheID" );
192 return $externalBlobCache[$cacheID];
196 "ExternalStoreDB::fetchBlob cache miss on $cacheID" );
200 'blob_text',
array(
'blob_id' => $id ), __METHOD__ );
201 if (
$ret ===
false ) {
203 "ExternalStoreDB::fetchBlob master fallback on $cacheID" );
207 'blob_text',
array(
'blob_id' => $id ), __METHOD__ );
208 if (
$ret ===
false ) {
210 "ExternalStoreDB::fetchBlob master failed to find $cacheID" );
213 if ( $itemID !==
false &&
$ret !==
false ) {
218 $externalBlobCache =
array( $cacheID =>
$ret );
234 array(
'blob_id',
'blob_text' ),
array(
'blob_id' => array_keys( $ids ) ), __METHOD__ );
236 if (
$res !==
false ) {
241 " master fallback on '$cluster' for: " .
242 implode(
',', array_keys( $ids ) ) );
246 array(
'blob_id',
'blob_text' ),
247 array(
'blob_id' => array_keys( $ids ) ),
249 if (
$res ===
false ) {
250 wfDebugLog( __CLASS__, __METHOD__ .
" master failed on '$cluster'" );
257 " master on '$cluster' failed locating items: " .
258 implode(
',', array_keys( $ids ) ) );
271 foreach (
$res as $row ) {
273 $itemIDs = $ids[$id];
275 if ( count( $itemIDs ) === 1 && reset( $itemIDs ) ===
false ) {
277 $ret[$id] = $row->blob_text;
280 $ret[$id] = unserialize( $row->blob_text );
286 $path = explode(
'/', $url );
batchFetchBlobs( $cluster, array $ids)
Fetch multiple blob items out of the database.
Accessable external objects in a particular storage medium.
getSlave( $cluster)
Get a slave database connection for the specified cluster.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
DB accessable external objects.
batchFetchFromURLs(array $urls)
Fetch data from given external store URLs.
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
fetchBlob( $cluster, $id, $itemID)
Fetch a blob item out of the database; a cache of the last-loaded blob will be kept so that multiple ...
getLoadBalancer( $cluster)
Get a LoadBalancer for the specified cluster.
if( $wgAPIRequestLog) $lb
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
processing should stop and the error should be shown to the user * false
getTable( $db)
Get the 'blobs' table name for this database.
fetchFromURL( $url)
The provided URL is in the form of DB://cluster/id or DB://cluster/id/itemid for concatened storage.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
& wfGetLBFactory()
Get the load balancer factory object.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
mergeBatchResult(array &$ret, array &$ids, $res)
Helper function for self::batchFetchBlobs for merging master/slave results.
getMaster( $cluster)
Get a master database connection for the specified cluster.