summaryrefslogtreecommitdiff
blob: 7596313cb49486e36d185c03aa758d6e81963518 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?

	require_once 'header.php';
	
	if(!$tree) {
		$tree =& PortageTree::singleton();
	}
	
	require_once 'class.portage.use_flag.php';
	require_once 'class.portage.ebuild.php';
	require_once 'class.portage.atom.php';
	require_once 'class.db.mtime.php';
	require_once 'class.db.use.php';
	require_once 'File/Find.php';
	
 	// Expand use flags
	$type = 'expand';
	$arr_new[$type] = $arr_delete[$type] = $arr_use_flags[$type] = array();
	
	$arr_find = File_Find::search('desc$', $tree->getTree().'/profiles/desc/');
	 
	foreach($arr_find as $filename) {
	
		$basename = $prefix = basename($filename);
		$prefix = str_replace(".desc", "", $prefix);
		
		$u = new PortageUseFlag($type, $prefix);
		$filemtime = filemtime($u->filename);
		$arr_use_flags[$type] = array_merge($arr_use_flags[$type], $u->getUseFlags());
		$keys = array_keys($u->getUseFlags());
		$where = "prefix = ".$db->quote($prefix);
	
		$dbmtime = new DBMtime($u->filename);
		
		$sql = "SELECT COUNT(1) FROM use WHERE $where;";
		$db_count = $db->getOne($sql);
		
		if(is_null($dbmtime->mtime) || ($filemtime > $dbmtime->mtime) ) {
			$dbmtime->mtime = $filemtime;
		}
	
	}
	
	foreach($arr_use_flags[$type] as $name => $arr) {
	
		extract($arr);
	
 		$dbuse = new DBUse($name, 'expand', $prefix);
 		if($dbuse->description != $description)
 			$dbuse->description = $description;
 		if($dbuse->prefix != $prefix)
 			$dbuse->prefix = $prefix;
 	}
	
?>