summaryrefslogtreecommitdiff
blob: 5b7f6cafa1eb1129bc229703366c105519402036 (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';
	require_once 'class.portage.tree.php';
	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';
	
	$tree = new PortageTree();
	
  	// 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;
				
				
			}
		}
	}

?>