blob: af379fb91d891d1fbbf18f3401fa4846ac59e20f (
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
|
<?
$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;
}
if($include_path) {
ini_set('include_path', ini_get('include_path').$include_path);
require_once "mdb2/charlie.portage.php";
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);
}
?>
|