summaryrefslogtreecommitdiff
blob: b441f3807a3937aa59ba397fed36af5dd16702ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
function get_pkgdirs($dir=null) {
	global $S;
	if ($dir===null) {
		$dir=$S['conf']['pkgdir_root'];
	}
	if (is_file($dir.'/Packages')) {
		// We assume that a dir with a Packages file will not contain other complete ppkgdirs
		return array(substr($dir, strlen($S['conf']['pkgdir_root'])+1));
	} else {
		$return=array();
		foreach (glob ($dir.'/*', GLOB_ONLYDIR) as $subdir) {
			$return=array_merge($return, get_pkgdirs($subdir));
		}
		return $return;
	}
}
?>