Add RepoGroup::getRepoByName, which gets a repo by its name as opposed to its index.
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 9 Feb 2008 13:40:16 +0000 (13:40 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 9 Feb 2008 13:40:16 +0000 (13:40 +0000)
includes/filerepo/RepoGroup.php

index f825a38..b0e1d78 100644 (file)
@@ -112,6 +112,19 @@ class RepoGroup {
                        return false;
                }
        }
+       /**
+        * Get the repo instance by its name
+        */
+       function getRepoByName( $name ) {
+               if ( !$this->reposInitialised ) {
+                       $this->initialiseRepos();
+               }
+               foreach ( $this->foreignRepos as $key => $repo ) {
+                       if ( $repo->name == $name)
+                               return $repo;
+               }
+               return false;
+       }
 
        /**
         * Get the local repository, i.e. the one corresponding to the local image