// ///////////////////////// REPOSITORY PATH
// -------------------------------------------------------------------
// The path to your repository or the parent-path for a directory of
-// repositories
+// repositories. This can also be an array to specify individual
+// repository paths.
$conf['repository']['path'] = '/home/svn/repos/';
// ###################################################################
// Set this to TRUE if the above path is actually a parent-path
$conf['repository']['iscontainer'] = false;
+// Repository names to include in the container. If this array is empty,
+// all repositories will be added, otherwise it will only be the ones
+// in the array.
+$conf['repository']['include'] = array();
+
// ###################################################################
// ///////////////////////// WEB PATH
// -------------------------------------------------------------------
* @var array
*/
private $repositories = array();
-
- /**
- * Root path to the repository
- * @var string
- */
- private $path;
-
+
/**
* Whether or not the path is a container
* @var bool
/**
* Constructor: prepare for repository
*
- * @param string Path to repository or container
+ * @param mixed Path to repository or container
* @param bool Whether the path is a container
+ * @param array Array of paths to include (only applicable with containers)
*/
- function __construct($path, $iscontainer)
+ function __construct($path, $iscontainer, $include)
{
global $viewsvn;
- $this->path = BSFunctions::FetchSourcePath($path);
- $this->container = (bool)$iscontainer;
-
- if ($this->container)
+ if (is_array($include) AND sizeof($include) > 0 AND $iscontainer)
+ {
+ $this->container = (sizeof($include) > 1);
+ foreach ($include AS $repos)
+ {
+ $this->repositories[$repos] = BSFunctions::FetchSourcePath(BSFunctions::FetchSourcePath($path) . $repos);
+ }
+ }
+ else
{
- if ($dir = @opendir($this->path))
+ $path = BSFunctions::FetchSourcePath($path);
+ $this->container = (bool)$iscontainer;
+ if ($this->container)
{
- while (($file = readdir($dir)) !== false)
+ if ($dir = @opendir($path))
{
- if (is_dir($this->path . $file) AND $file{0} != '.' AND is_dir($this->path . $file . '/' . 'db'))
+ while (($file = readdir($dir)) !== false)
{
- $this->repositories[] = $file;
+ if (is_dir($path . $file) AND $file{0} != '.' AND is_dir($path . $file . '/' . 'db'))
+ {
+ $this->repositories[$file] = $path . $file;
+ }
}
+ closedir($dir);
}
- closedir($dir);
}
- }
- else
- {
- if (is_dir($this->path . 'db'))
+ else
{
- $this->repositories[] = $this->path;
+ if (is_dir($path . 'db'))
+ {
+ $this->repositories[basename($path)] = $path;
+ }
}
}
- sort($this->repositories);
+ ksort($this->repositories);
if (sizeof($this->repositories) < 1)
{
*/
public function fetchList()
{
- return $this->repositories;
+ return array_keys($this->repositories);
}
// ###################################################################
{
global $viewsvn;
- if (!in_array($repository, $this->repositories))
+ if (!isset($this->repositories[$repository]))
{
$viewsvn->trigger->error(_('Invalid repository name specified'));
}
- if ($this->container)
- {
- return 'file://' . $this->path . $repository;
- }
- else
- {
- return 'file://' . $this->path;
- }
+ return 'file://' . $this->repositories[$repository];
}
// ###################################################################