Browse Source

Repositories: include repositories from gitea (via $config['repositories_gitea'])

master
parent
commit
f26ead7c8e
  1. 3
      conf.php-dist
  2. 21
      src/repositories.php

3
conf.php-dist

@ -7,6 +7,9 @@ $config['repositories'] = array(
),
);
// Repositories which should be included from gitea
$config['repositories_gitea'] = "/home/gitea/gitea-repositories";
// Set to true to reload categories on every page visit.
$config['categoriesAlwaysReload'] = true;

21
src/repositories.php

@ -14,6 +14,27 @@ function getRepositories () {
);
}
if (isset($config['repositories_gitea'])) {
$d1 = opendir($config['repositories_gitea']);
while ($f1 = readdir($d1)) {
if (substr($f1, 0, 1) !== '.') {
$d2 = opendir("{$config['repositories_gitea']}/{$f1}");
while ($f2 = readdir($d2)) {
if (substr($f2, 0, 1) !== '.') {
$f2id = substr($f2, 0, -4);
$repositories["{$f1}.{$f2id}"] = array(
'path' => "{$p}/{$f1}/{$f2}",
'type' => 'git',
);
}
}
closedir($d2);
}
}
closedir($d1);
}
return $repositories;
}

Loading…
Cancel
Save