Here is a function that returns an array with the directories in the root of the HEAD revision of a repository, using only the path of the repository.
<?php
function get_repo_dirs($path){
if (file_exists($path.'/format'))
if ($repo = svn_repos_open($path))
if ($repo_fs = svn_repos_fs($repo))
if ($head = svn_fs_youngest_rev($repo_fs))
if ($repo_fs_root = svn_fs_revision_root($repo_fs,$head))
return array_keys(svn_fs_dir_entries($repo_fs_root,'.'));
else return false;
}
?>
example usage
<?php
var_dump (get_repo_dirs('/home/user/svnrepos/example_project'));
?>
svn_fs_dir_entries
(PECL svn >= 0.1.0)
svn_fs_dir_entries — Enumerates the directory entries under path; returns a hash of dir names to file type
Opis
array svn_fs_dir_entries
( resource
$fsroot
, string $path
)Ostrzeżenie
Ta funkcja jest obecnie nieudokumentowana, dostępna jest jedynie lista jej argumentów.
Enumerates the directory entries under path; returns a hash of dir names to file type
Notatki
Ostrzeżenie
Ta funkcja jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie funkcji, jej nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP bez wcześniejszego uprzedzenia. Używaj tej funkcji na własne ryzyko.
qwazix at outofbounds dot gr
08-Feb-2011 09:05
