From: Aaron Schulz Date: Tue, 13 Aug 2013 07:07:29 +0000 (-0700) Subject: Added batchFetchFromURLs() for mwstore backend X-Git-Tag: 1.31.0-rc.0~18983^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=9e54e6239c6133c6de0d7acfafd3044196d048c0;p=lhc%2Fweb%2Fwiklou.git Added batchFetchFromURLs() for mwstore backend Change-Id: I71cfe206c8eef79acb6507bc841a4798747a5f84 --- diff --git a/includes/externalstore/ExternalStoreMwstore.php b/includes/externalstore/ExternalStoreMwstore.php index 0911cca100..aa486796f3 100644 --- a/includes/externalstore/ExternalStoreMwstore.php +++ b/includes/externalstore/ExternalStoreMwstore.php @@ -46,6 +46,29 @@ class ExternalStoreMwstore extends ExternalStoreMedium { return false; } + /** + * Fetch data from given external store URLs. + * The URL returned is of the form of the form mwstore://backend/container/wiki/id + * + * @param array $urls An array of external store URLs + * @return array A map from url to stored content. Failed results are not represented. + */ + public function batchFetchFromURLs( array $urls ) { + $pathsByBackend = array(); + foreach ( $urls as $url ) { + $be = FileBackendGroup::singleton()->backendFromPath( $url ); + if ( $be instanceof FileBackend ) { + $pathsByBackend[$be->getName()][] = $url; + } + } + $blobs = array(); + foreach ( $pathsByBackend as $backendName => $paths ) { + $be = FileBackendGroup::get( $backendName ); + $blobs = $blobs + $be->getFileContentsMulti( array( 'srcs' => $paths ) ); + } + return $blobs; + } + /** * @see ExternalStoreMedium::store() */