|
@ -1,7 +1,6 @@ |
|
|
<?php |
|
|
<?php |
|
|
function getRepositories () { |
|
|
function getRepositories () { |
|
|
global $repositories; |
|
|
global $repositories; |
|
|
global $repositoriesGitea; |
|
|
|
|
|
$result = array(); |
|
|
$result = array(); |
|
|
|
|
|
|
|
|
if (isset($repositories)) { |
|
|
if (isset($repositories)) { |
|
@ -15,33 +14,7 @@ function getRepositories () { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (isset($repositoriesGitea)) { |
|
|
|
|
|
$d1 = opendir($repositoriesGitea['path']); |
|
|
|
|
|
while ($f1 = readdir($d1)) { |
|
|
|
|
|
if (substr($f1, 0, 1) !== '.') { |
|
|
|
|
|
$d2 = opendir("{$repositoriesGitea['path']}/{$f1}"); |
|
|
|
|
|
while ($f2 = readdir($d2)) { |
|
|
|
|
|
if (substr($f2, 0, 1) !== '.') { |
|
|
|
|
|
$f2id = substr($f2, 0, -4); |
|
|
|
|
|
|
|
|
|
|
|
$r = array( |
|
|
|
|
|
'path' => "{$repositoriesGitea['path']}/{$f1}/{$f2}", |
|
|
|
|
|
'type' => 'git', |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (array_key_exists('url', $repositoriesGitea)) { |
|
|
|
|
|
$r['repositoryUrl'] = "{$repositoriesGitea['url']}/{{ repositoryId }}"; |
|
|
|
|
|
$r['categoryUrl'] = "{$repositoriesGitea['url']}/{{ repositoryId }}/src/branch/{{ branchId }}/{{ categoryId }}.json"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$result["{$f1}/{$f2id}"] = $r; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
closedir($d2); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
closedir($d1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
call_hooks("get-repositories", $result); |
|
|
|
|
|
|
|
|
return $result; |
|
|
return $result; |
|
|
} |
|
|
} |
|
@ -57,14 +30,3 @@ function getRepo ($repoId, $repoData) { |
|
|
|
|
|
|
|
|
return $repo; |
|
|
return $repo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
register_hook('init', function () { |
|
|
|
|
|
global $repositoriesGitea; |
|
|
|
|
|
|
|
|
|
|
|
if (isset($repositoriesGitea) && array_key_exists('url', $repositoriesGitea)) { |
|
|
|
|
|
$d = array('repositoriesGitea' => array( |
|
|
|
|
|
'url' => $repositoriesGitea['url'], |
|
|
|
|
|
)); |
|
|
|
|
|
html_export_var($d); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|