jenkins-bot has submitted this change and it was merged.

Change subject: Added batchFetchFromURLs() for mwstore backend
......................................................................


Added batchFetchFromURLs() for mwstore backend

Change-Id: I71cfe206c8eef79acb6507bc841a4798747a5f84
---
M includes/externalstore/ExternalStoreMwstore.php
1 file changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/externalstore/ExternalStoreMwstore.php 
b/includes/externalstore/ExternalStoreMwstore.php
index 0911cca..aa48679 100644
--- a/includes/externalstore/ExternalStoreMwstore.php
+++ b/includes/externalstore/ExternalStoreMwstore.php
@@ -47,6 +47,29 @@
        }
 
        /**
+        * 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()
         */
        public function store( $backend, $data ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/78938
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I71cfe206c8eef79acb6507bc841a4798747a5f84
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to