Change-Id: Ie31c370ba497eedc7458973b704132cf4725cf1f
}
$class = 'ExternalStore' . ucfirst( $proto );
}
$class = 'ExternalStore' . ucfirst( $proto );
// Any custom modules should be added to $wgAutoLoadClasses for on-demand loading
return class_exists( $class ) ? new $class( $params ) : false;
}
// Any custom modules should be added to $wgAutoLoadClasses for on-demand loading
return class_exists( $class ) ? new $class( $params ) : false;
}
$retval[$url] = false;
}
}
$retval[$url] = false;
}
}
if ( $itemID !== false && $ret !== false ) {
return $ret->getItem( $itemID );
}
if ( $itemID !== false && $ret !== false ) {
return $ret->getItem( $itemID );
}
$ret = array();
foreach ( $batched as $cluster => $batchByCluster ) {
$res = $this->batchFetchBlobs( $cluster, $batchByCluster );
$ret = array();
foreach ( $batched as $cluster => $batchByCluster ) {
$res = $this->batchFetchBlobs( $cluster, $batchByCluster );
+ /** @var HistoryBlob $blob */
foreach ( $res as $id => $blob ) {
foreach ( $batchByCluster[$id] as $itemID ) {
$url = $inverseUrlMap[$cluster][$id][$itemID];
foreach ( $res as $id => $blob ) {
foreach ( $batchByCluster[$id] as $itemID ) {
$url = $inverseUrlMap[$cluster][$id][$itemID];
if ( $dbw->getFlag( DBO_TRX ) ) {
$dbw->commit( __METHOD__ );
}
if ( $dbw->getFlag( DBO_TRX ) ) {
$dbw->commit( __METHOD__ );
}
return "DB://$cluster/$id";
}
return "DB://$cluster/$id";
}
function &getMaster( $cluster ) {
$wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
$lb =& $this->getLoadBalancer( $cluster );
function &getMaster( $cluster ) {
$wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
$lb =& $this->getLoadBalancer( $cluster );
return $lb->getConnection( DB_MASTER, array(), $wiki );
}
return $lb->getConnection( DB_MASTER, array(), $wiki );
}
if ( is_null( $table ) ) {
$table = 'blobs';
}
if ( is_null( $table ) ) {
$table = 'blobs';
}
if ( isset( $externalBlobCache[$cacheID] ) ) {
wfDebugLog( 'ExternalStoreDB-cache',
"ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
if ( isset( $externalBlobCache[$cacheID] ) ) {
wfDebugLog( 'ExternalStoreDB-cache',
"ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
return $externalBlobCache[$cacheID];
}
return $externalBlobCache[$cacheID];
}
}
$externalBlobCache = array( $cacheID => &$ret );
}
$externalBlobCache = array( $cacheID => &$ret );
*
* @param string $cluster A cluster name valid for use with LBFactory
* @param array $ids A map from the blob_id's to look for to the requested itemIDs in the blobs
*
* @param string $cluster A cluster name valid for use with LBFactory
* @param array $ids A map from the blob_id's to look for to the requested itemIDs in the blobs
- * @return array A map from the blob_id's requested to their content. Unlocated ids are not represented
+ * @return array A map from the blob_id's requested to their content.
+ * Unlocated ids are not represented
*/
function batchFetchBlobs( $cluster, array $ids ) {
$dbr = $this->getSlave( $cluster );
*/
function batchFetchBlobs( $cluster, array $ids ) {
$dbr = $this->getSlave( $cluster );
" master on '$cluster' failed locating items: " .
implode( ',', array_keys( $ids ) ) . "\n" );
}
" master on '$cluster' failed locating items: " .
implode( ',', array_keys( $ids ) ) . "\n" );
}
protected function parseURL( $url ) {
$path = explode( '/', $url );
protected function parseURL( $url ) {
$path = explode( '/', $url );
return array(
$path[2], // cluster
$path[3], // id
return array(
$path[2], // cluster
$path[3], // id
$retval[$url] = $data;
}
}
$retval[$url] = $data;
}
}
// backends should at least have "read-after-create" consistency.
return $be->getFileContents( array( 'src' => $url ) );
}
// backends should at least have "read-after-create" consistency.
return $be->getFileContents( array( 'src' => $url ) );
}
$be = FileBackendGroup::singleton()->get( $backendName );
$blobs = $blobs + $be->getFileContentsMulti( array( 'srcs' => $paths ) );
}
$be = FileBackendGroup::singleton()->get( $backendName );
$blobs = $blobs + $be->getFileContentsMulti( array( 'srcs' => $paths ) );
}