}
global $wgLocalFileRepo, $wgForeignFileRepos;
self::$instance = new RepoGroup( $wgLocalFileRepo, $wgForeignFileRepos );
+
return self::$instance;
}
# Check the cache
if ( empty( $options['ignoreRedirect'] )
&& empty( $options['private'] )
- && empty( $options['bypassCache'] ) )
- {
+ && empty( $options['bypassCache'] )
+ ) {
$time = isset( $options['time'] ) ? $options['time'] : '';
$dbkey = $title->getDBkey();
if ( isset( $this->cache[$dbkey][$time] ) ) {
wfDebug( __METHOD__ . ": got File:$dbkey from process cache\n" );
# Move it to the end of the list so that we can delete the LRU entry later
$this->pingCache( $dbkey );
+
# Return the entry
return $this->cache[$dbkey][$time];
}
$images = array_merge( $images, $repo->findFiles( $items ) );
}
+
return $images;
}
}
$redir = $this->localRepo->checkRedirect( $title );
- if( $redir ) {
+ if ( $redir ) {
return $redir;
}
foreach ( $this->foreignRepos as $repo ) {
return $redir;
}
}
+
return false;
}
if ( !$file ) {
foreach ( $this->foreignRepos as $repo ) {
$file = $repo->findFileFromKey( $hash, $options );
- if ( $file ) break;
+ if ( $file ) {
+ break;
+ }
}
}
+
return $file;
}
$result = array_merge( $result, $repo->findBySha1( $hash ) );
}
usort( $result, 'File::compare' );
+
return $result;
}
$result = array_merge_recursive( $result, $repo->findBySha1s( $hashes ) );
}
//sort the merged (and presorted) sublist of each hash
- foreach( $result as $hash => $files ) {
+ foreach ( $result as $hash => $files ) {
usort( $result[$hash], 'File::compare' );
}
+
return $result;
}
return $repo;
}
}
+
return false;
}
* @return bool
*/
function forEachForeignRepo( $callback, $params = array() ) {
- foreach( $this->foreignRepos as $repo ) {
+ foreach ( $this->foreignRepos as $repo ) {
$args = array_merge( array( $repo ), $params );
- if( call_user_func_array( $callback, $args ) ) {
+ if ( call_user_func_array( $callback, $args ) ) {
return true;
}
}
+
return false;
}
*/
protected function newRepo( $info ) {
$class = $info['class'];
+
return new $class( $info );
}
if ( count( $bits ) != 3 ) {
throw new MWException( __METHOD__ . ": invalid mwrepo URL: $url" );
}
+
return $bits;
}
$repoName = 'local';
}
$repo = $this->getRepo( $repoName );
+
return $repo->getFileProps( $fileName );
} else {
return FSFile::getPropsFromPath( $fileName );