Update documentation
[lhc/web/wiklou.git] / includes / filerepo / RepoGroup.php
index 02dfdad..62e9cc0 100644 (file)
@@ -53,6 +53,7 @@ class RepoGroup {
                }
                global $wgLocalFileRepo, $wgForeignFileRepos;
                self::$instance = new RepoGroup( $wgLocalFileRepo, $wgForeignFileRepos );
+
                return self::$instance;
        }
 
@@ -126,14 +127,15 @@ class RepoGroup {
                # 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];
                        }
@@ -195,6 +197,7 @@ class RepoGroup {
 
                        $images = array_merge( $images, $repo->findFiles( $items ) );
                }
+
                return $images;
        }
 
@@ -209,7 +212,7 @@ class RepoGroup {
                }
 
                $redir = $this->localRepo->checkRedirect( $title );
-               if( $redir ) {
+               if ( $redir ) {
                        return $redir;
                }
                foreach ( $this->foreignRepos as $repo ) {
@@ -218,6 +221,7 @@ class RepoGroup {
                                return $redir;
                        }
                }
+
                return false;
        }
 
@@ -238,9 +242,12 @@ class RepoGroup {
                if ( !$file ) {
                        foreach ( $this->foreignRepos as $repo ) {
                                $file = $repo->findFileFromKey( $hash, $options );
-                               if ( $file ) break;
+                               if ( $file ) {
+                                       break;
+                               }
                        }
                }
+
                return $file;
        }
 
@@ -260,6 +267,7 @@ class RepoGroup {
                        $result = array_merge( $result, $repo->findBySha1( $hash ) );
                }
                usort( $result, 'File::compare' );
+
                return $result;
        }
 
@@ -279,9 +287,10 @@ class RepoGroup {
                        $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;
        }
 
@@ -317,6 +326,7 @@ class RepoGroup {
                                return $repo;
                        }
                }
+
                return false;
        }
 
@@ -339,12 +349,13 @@ class RepoGroup {
         * @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;
        }
 
@@ -377,6 +388,7 @@ class RepoGroup {
         */
        protected function newRepo( $info ) {
                $class = $info['class'];
+
                return new $class( $info );
        }
 
@@ -395,6 +407,7 @@ class RepoGroup {
                if ( count( $bits ) != 3 ) {
                        throw new MWException( __METHOD__ . ": invalid mwrepo URL: $url" );
                }
+
                return $bits;
        }
 
@@ -409,6 +422,7 @@ class RepoGroup {
                                $repoName = 'local';
                        }
                        $repo = $this->getRepo( $repoName );
+
                        return $repo->getFileProps( $fileName );
                } else {
                        return FSFile::getPropsFromPath( $fileName );