|
@@ 62-68 (lines=7) @@
|
| 59 |
|
*/ |
| 60 |
|
public function batchFetchFromURLs( array $urls ) { |
| 61 |
|
$batched = $inverseUrlMap = []; |
| 62 |
|
foreach ( $urls as $url ) { |
| 63 |
|
list( $cluster, $id, $itemID ) = $this->parseURL( $url ); |
| 64 |
|
$batched[$cluster][$id][] = $itemID; |
| 65 |
|
// false $itemID gets cast to int, but should be ok |
| 66 |
|
// since we do === from the $itemID in $batched |
| 67 |
|
$inverseUrlMap[$cluster][$id][$itemID] = $url; |
| 68 |
|
} |
| 69 |
|
$ret = []; |
| 70 |
|
foreach ( $batched as $cluster => $batchByCluster ) { |
| 71 |
|
$res = $this->batchFetchBlobs( $cluster, $batchByCluster ); |
|
@@ 74-81 (lines=8) @@
|
| 71 |
|
$res = $this->batchFetchBlobs( $cluster, $batchByCluster ); |
| 72 |
|
/** @var HistoryBlob $blob */ |
| 73 |
|
foreach ( $res as $id => $blob ) { |
| 74 |
|
foreach ( $batchByCluster[$id] as $itemID ) { |
| 75 |
|
$url = $inverseUrlMap[$cluster][$id][$itemID]; |
| 76 |
|
if ( $itemID === false ) { |
| 77 |
|
$ret[$url] = $blob; |
| 78 |
|
} else { |
| 79 |
|
$ret[$url] = $blob->getItem( $itemID ); |
| 80 |
|
} |
| 81 |
|
} |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
|