X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2FRepoGroup.php;h=f9e575992032169eef7982ecb92383c7b942aeec;hb=4878e9593c313e0ab6d4a81a3ecea36a0afdb291;hp=6b31b7e54d6dfcd3874e79ee1523dd35ea4951eb;hpb=cf4da8140bb49803360bcf610ff88d3c19cd07b0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 6b31b7e54d..f9e5759920 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -263,6 +263,28 @@ class RepoGroup { return $result; } + /** + * Find all instances of files with this keys + * + * @param $hashes Array base 36 SHA-1 hashes + * @return Array of array of File objects + */ + function findBySha1s( array $hashes ) { + if ( !$this->reposInitialised ) { + $this->initialiseRepos(); + } + + $result = $this->localRepo->findBySha1s( $hashes ); + foreach ( $this->foreignRepos as $repo ) { + $result = array_merge_recursive( $result, $repo->findBySha1s( $hashes ) ); + } + //sort the merged (and presorted) sublist of each hash + foreach( $result as $hash => $files ) { + usort( $result[$hash], 'File::compare' ); + } + return $result; + } + /** * Get the repo instance with a given key. * @param $index string|int