summaryrefslogtreecommitdiff
blob: 1f3942069c853b2ae30340f6ad0950ac7082d80c (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 $conf;
	if ($dir===null) {
		$dir=$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($conf['pkgdir_root'])+1));
	} else {
		$return=array();
		foreach (glob ($dir.'/*', GLOB_ONLYDIR) as $subdir) {
			$return=array_merge($return, get_pkgdirs($subdir));
		}
		return $return;
	}
}
?>