summaryrefslogtreecommitdiff
blob: 9a0a81e361bf831c8d99adcbf0172984eee59622 (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
56
57
<?

	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 'class.db.package_use.php';
	require_once 'File/Find.php';
	
  	// Local use flags
 	$type = 'local';
 	$u = new PortageUseFlag($type);
  	$filemtime = filemtime($u->filename);
  	$arr_use_flags[$type] = $u->getUseFlags();
  	$keys = array_keys($arr_use_flags[$type]);
  	
  	$dbmtime = new DBMtime($u->filename);
  	
  	$import = false;
  	
  	if(is_null($dbmtime->mtime)) {
		$dbmtime->mtime = $dbmtime->filemtime;
		$import = true;
	} elseif($filemtime > $dbmtime->mtime) {
		$dbmtime->mtime = $filemtime;
		$import = true;
	}
  	
  	if($import) {
		foreach($arr_use_flags[$type] as $cp => $arr_package_use_flags) {
		
			$sql = "SELECT package FROM view_package WHERE cp = ".$db->quote($cp).";";
			$package = $db->getOne($sql);
			
			foreach($arr_package_use_flags as $name => $arr) {
				extract($arr);
				
				$dbuse = new DBUse($name, 'local', $cp);
				
				$dbpackage_use = new DBPackageUse($package, $dbuse->id);
				
				if($dbpackage_use->description != $description)
					$dbpackage_use->description = $description;
				
				
			}
		}
	}

?>