/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
1 by Suren A. Chilingaryan
Initial import
1
<?php
205.1.1 by Suren A. Chilingaryan
Support for ZEUS backup for MSSQL-based installations, still backed-up in MySQL
2
$res = exec('ps xa | grep "backup.php" | grep -v grep | wc -l');
3
if ($res > 1) exit;
4
206 by Suren A. Chilingaryan
Fix calling backup from cron scripts, fix XMLMODULE in konqueror's webkit mode, override search modules in the 'all' setup
5
if (preg_match("/(.*)backup.php$/", $_SERVER['SCRIPT_FILENAME'], $m)) @chdir($m[1]);
6
1 by Suren A. Chilingaryan
Initial import
7
require("../adei.php");
8
9
/*
10
$config = array (
11
    "db_server" => "katrin", 
12
    "db_name" => "hauptspektrometer"
13
);
14
*/
15
16
17
function DoBackup(&$req, &$backup) {
18
    try {
19
	$reader = $req->CreateReader(REQUEST::READER_FORBID_CACHEREADER);
205.1.1 by Suren A. Chilingaryan
Support for ZEUS backup for MSSQL-based installations, still backed-up in MySQL
20
	$reader->Backup($backup, READER::BACKUP_FULL);
1 by Suren A. Chilingaryan
Initial import
21
	unset($reader);
22
    
23
24
25
26
	
27
//	$bzeus  = new ZEUS($srv);
28
29
//	$bzeus = new ZEUS($bprops);
30
    
31
/*    
32
	$zeus = new ZEUS($props);
33
	$groups = $zeus->GetGroups();
34
	    
35
	
36
	
37
	
38
	echo $bdb;
39
	foreach ($groups as $group) {
40
41
	}
42
*/
43
/*	
44
	$cprops = $props;
45
	foreach (array_keys($groups) as $group) {
46
	    $cprops['db_group'] = $group;
47
	    $lg = new LOGGROUP($cprops);
48
	    $zlg = new ZEUSLogGroup($lg);
49
	    
50
	    $cache = new CACHE($cprops, $zeus);
51
	    $cache->Update();
52
	}*/
53
    } catch(ADEIException $e) {
24 by Suren A. Chilingaryan
Logger subsystem
54
	$e->logInfo("Backup is failed", $reader?$reader:$req);
55
	$error = $e->getInfo();
1 by Suren A. Chilingaryan
Initial import
56
    }
57
    return $error?$error:0;
58
}
59
60
61
62
63
$req = new REQUEST($config);
35 by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation
64
$list = $req->GetSources();
1 by Suren A. Chilingaryan
Initial import
65
66
foreach ($list as $sreq) {
67
    $opts = &$sreq->GetOptions();
68
    $backup = $opts->Get('backup');
69
    if ($backup) {
70
	$err = DoBackup($sreq, $backup);
71
	if ($err) 
72
	    echo $sreq->GetLocationString() . ", Error: $err\n";
73
    }
74
}
75
76
77
?>