summaryrefslogtreecommitdiff
blob: 0e53d229e9f1ea50d2a326a94da8f1394b7fb16d (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
<?

	$hostname = php_uname('n');
	switch($hostname) {
	
		case 'charlie':
		
			$include_path = ":/home/steve/php/inc:/home/steve/svn/znurt";
			$mdb2 = "mdb2/charlie.portage.php";
		
			break;
		
		case 'rom':
		
			$include_path = ":/home/steve/php/inc:/home/steve/svn/znurt";
			$mdb2 = "mdb2/rom.portage.php";
		
			break;
		
		case 'tenforward':
		
			$include_path = ":/var/www/znurt.org/inc:/var/www/znurt.org/htdocs";
			$mdb2 = "mdb2/tenforward.portage.php";
		
			break;
		
		case 'alan-one':
		
			$include_path = ":/var/www/znurt.org/inc:/var/www/znurt.org/htdocs";
			$mdb2 = "mdb2/alan-one.portage.php";
		
			break;
	
	}

	if($include_path) {
		ini_set('include_path', ini_get('include_path').$include_path);
		
		require_once $mdb2;
		require_once 'class.common.php';
		require_once 'class.shell.php';
	}
	
	$now = $db->getOne("SELECT NOW();");
	
	function importDiff($table, $arr_new, $where = "") {
 		
 		global $db;
 		
 		if($where)
 			$where = "WHERE $where";
 		
 		$sql = "SELECT name FROM $table $where ORDER BY name;";
 		$arr_old = $db->getCol($sql);
 		
 		$arr_insert = array_diff($arr_new, $arr_old);
 		$arr_delete = array_diff($arr_old, $arr_new);
 		
 		$arr = array('insert' => $arr_insert, 'delete' => $arr_delete);
 		
 		return($arr);
 	}

?>