From: Bryan Tong Minh Date: Sat, 9 Feb 2008 13:40:16 +0000 (+0000) Subject: Add RepoGroup::getRepoByName, which gets a repo by its name as opposed to its index. X-Git-Tag: 1.31.0-rc.0~49546 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=d7f2a35f05322178f362ed3c90435d77217c6149;p=lhc%2Fweb%2Fwiklou.git Add RepoGroup::getRepoByName, which gets a repo by its name as opposed to its index. --- 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