blob: bd626f26d357e2936278b43519aefa06f038157a (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
<?
require_once 'header.php';
if(!$tree) {
require_once 'class.portage.tree.php';
$tree = new PortageTree();
}
require_once 'class.portage.use_flag.php';
require_once 'class.portage.ebuild.php';
require_once 'class.portage.atom.php';
require_once '/home/steve/svn/znurt/class.db.mtime.php';
require_once '/home/steve/svn/znurt/class.db.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);
foreach($arr_use_flags[$type] as $cp => $arr_package_use_flags) {
shell::msg($cp);
print_r($arr_package_use_flags);
die;
$sql = "SELECT package FROM view_package WHERE cp = ".$db->quote($cp);
$package = $db->getOne($sql);
foreach($arr_package_use_flags as $name => $arr) {
$where = "package = $package";
$sql = "SELECT COUNT(1) FROM use WHERE $where;";
$db_count = $db->getOne($sql);
if(is_null($dbmtime->mtime)) {
}
}
}
$arr_new[$type] = $arr_delete[$type] = array();
if(is_null($dbmtime->mtime)) {
$arr_new[$type] = $keys;
$dbmtime->mtime = $dbmtime->filemtime;
} elseif(($filemtime > $db_mtime) || ($db_count != count($keys))) {
$arr_import = importDiff('use', $keys, $where);
$arr_new[$type] = $arr_import['insert'];
$arr_delete[$type] = $arr_import['delete'];
$dbmtime->mtime = $filemtime;
}
// if(count($arr_diff['delete'])) {
// foreach($arr_diff['delete'] as $name) {
// $sql = "DELETE FROM $table WHERE name = ".$db->quote($name).";";
// $db->query($sql);
// }
// }
//
// if(count($arr_diff['insert'])) {
// foreach($arr_diff['insert'] as $name) {
// $arr_insert = array('name' => $name);
// $db->autoExecute($table, $arr_insert, MDB2_AUTOQUERY_INSERT);
// }
// }
?>
|