]>
src.bluestatic.org Git - viewsvn.git/blob - includes/repository.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # ViewSVN [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
14 * Class that manages repositories and can produce lists of
21 * Repository class that can list repositories and prepare
30 * Array of valid repositories
33 var $repositories = array();
36 * Root path to the repository
42 * Whether or not the path is a container
48 * Constructor: prepare for repository
50 * @param string Path to repository or container
51 * @param bool Whether the path is a container
53 function Repository($path, $iscontainer)
57 $this->path
= $viewsvn->fetch_sourcepath($path);
58 $this->container
= (bool)$iscontainer;
62 if ($dir = @opendir($this->path
))
64 while (($file = readdir($dir)) !== false)
66 if (is_dir($this->path
. $file) AND $file{0} != '.' AND is_dir($this->path
. $file . '/' . 'db'))
68 $this->repositories
[] = $file;
76 if (is_dir($this->path
. 'db'))
78 $this->repositories
[] = $this->path
;
82 if (count($this->repositories
) < 1)
84 $viewsvn->trigger
->error('no valid repositories');
89 * Returns a list of repositories
93 * @return array List of repositories
97 return $this->repositories
;
101 * Returns a path to a repository
105 * @param string Repository name
107 * @return string Full path to the repository
109 function fetch_path($repository = '')
113 if (!in_array($repository, $this->fetch_list()))
115 $viewsvn->trigger
->error('invalid repository name');
118 if ($this->container
)
120 return $this->path
. $repository;
129 /*=====================================================================*\
130 || ###################################################################
133 || ###################################################################
134 \*=====================================================================*/