/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
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
<?php
$res = exec('ps xa | grep "backup.php" | grep -v grep | wc -l');
if ($res > 1) exit;

if (preg_match("/(.*)backup.php$/", $_SERVER['SCRIPT_FILENAME'], $m)) @chdir($m[1]);

require("../adei.php");

/*
$config = array (
    "db_server" => "katrin", 
    "db_name" => "hauptspektrometer"
);
*/


function DoBackup(&$req, &$backup) {
    try {
	$reader = $req->CreateReader(REQUEST::READER_FORBID_CACHEREADER);
	$reader->Backup($backup, READER::BACKUP_FULL);
	unset($reader);
    



	
//	$bzeus  = new ZEUS($srv);

//	$bzeus = new ZEUS($bprops);
    
/*    
	$zeus = new ZEUS($props);
	$groups = $zeus->GetGroups();
	    
	
	
	
	echo $bdb;
	foreach ($groups as $group) {

	}
*/
/*	
	$cprops = $props;
	foreach (array_keys($groups) as $group) {
	    $cprops['db_group'] = $group;
	    $lg = new LOGGROUP($cprops);
	    $zlg = new ZEUSLogGroup($lg);
	    
	    $cache = new CACHE($cprops, $zeus);
	    $cache->Update();
	}*/
    } catch(ADEIException $e) {
	$e->logInfo("Backup is failed", $reader?$reader:$req);
	$error = $e->getInfo();
    }
    return $error?$error:0;
}




$req = new REQUEST($config);
$list = $req->GetSources();

foreach ($list as $sreq) {
    $opts = &$sreq->GetOptions();
    $backup = $opts->Get('backup');
    if ($backup) {
	$err = DoBackup($sreq, $backup);
	if ($err) 
	    echo $sreq->GetLocationString() . ", Error: $err\n";
    }
}


?>