From d7f2a35f05322178f362ed3c90435d77217c6149 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Sat, 9 Feb 2008 13:40:16 +0000 Subject: [PATCH] Add RepoGroup::getRepoByName, which gets a repo by its name as opposed to its index. --- includes/filerepo/RepoGroup.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index f825a38fde..b0e1d78202 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -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 -- 2.20.1