Blame view

src/REMOTEDATA/makeProxy.php 1.79 KB
41792000   Elena.Budnik   new REMOTEDATA
1
2
3
4
<?php
/*
*  Executable to make 'base.xml' proxies for Remote Centers (DD Server)
*/
0fb01225   Elena.Budnik   float sampling
5
6
	error_reporting(E_ERROR);
	
41792000   Elena.Budnik   new REMOTEDATA
7
8
9
10
11
12
13
14
15
	if (!function_exists('__autoload')) {
		function __autoload($class_name) {
					require_once $class_name . '.php';
		}
	}

   putenv("LD_LIBRARY_PATH=".getenv("LD_LIBRARY_PATH"));
	putenv("PATH=./:".getenv("DDBASEBIN").":/bin:/usr/bin");
	set_include_path("./:".getenv("DATAMANAGER").":".getenv("REMOTEDATA").":".getenv("CALLEXT")); 
cf197d4f   Benjamin Renard   Fix bug when DDBA...
16
17
18
19
20
21
22
23

	$DDBASE=getenv("DDBASE");
	if (is_link($DDBASE)) {
		$DDBASE=readlink($DDBASE);
		if ($DDBASE === FALSE) {
			exit(0);
		}
	}
d4071e27   Elena.Budnik   makeProxy with en...
24
	
cf197d4f   Benjamin Renard   Fix bug when DDBA...
25
	$LOGDIR = $DDBASE."/../LOG";
d4071e27   Elena.Budnik   makeProxy with en...
26
	if (!is_dir($LOGDIR))
69754a74   Elena.Budnik   access permission...
27
				mkdir($LOGDIR, 0775, true);
d4071e27   Elena.Budnik   makeProxy with en...
28
29
30
31
32
33
				
	define("log",$LOGDIR."/ProxyCreate.log");
	define("err",$LOGDIR."/ProxyCreate.err");
	
	if (file_exists(log)) unlink(log);
	if (file_exists(err)) unlink(err);
41792000   Elena.Budnik   new REMOTEDATA
34

cf197d4f   Benjamin Renard   Fix bug when DDBA...
35
	define('RemoteData',  $DDBASE."/../INFO");
41792000   Elena.Budnik   new REMOTEDATA
36
	
69754a74   Elena.Budnik   access permission...
37
38
	// check permissions
	$perms = fileperms(RemoteData);
20306440   Elena.Budnik   bug
39
	if (! ($perms & 0x0010)) 
69754a74   Elena.Budnik   access permission...
40
41
		exit('chmod -R g+wrx INFO dir !!! no write perms for group (apache)'.PHP_EOL);
	
d4071e27   Elena.Budnik   makeProxy with en...
42
43
44
45
46
47
48
49
50
51
	if (!file_exists(RemoteData."/Bases.xml"))
			exit('No Bases.xml'.PHP_EOL);

	$basesDom = new DomDocument("1.0");
 	if (!$basesDom->load(RemoteData."/Bases.xml"))
			exit('Cannot load Bases.xml'.PHP_EOL);

	$bases = $basesDom->getElementsByTagName("dataCenter");
	if ($bases->length == 0)
			exit('No Bases'.PHP_EOL);
9af6e03a   Elena.Budnik   config info separ...
52

41792000   Elena.Budnik   new REMOTEDATA
53
54
55
	$useSpase = true; 
	
	foreach ($bases as $base)
d4071e27   Elena.Budnik   makeProxy with en...
56
57
58
59
60
61
62
	{
		// isSimulation -> proxy is being made at AMDA
		if ($base->hasAttribute("isSimulation"))
				continue;
		$class = $base->getAttribute('xml:id');
		echo PHP_EOL.$class.PHP_EOL;
		$center = new $class();
41792000   Elena.Budnik   new REMOTEDATA
63
64
65
66
67
68
69
70
71
72
73
74
//  			if ($center->monitor())
//  			{
				$center->initProxy();
				$center->makeProxy();
				$center->saveProxy();
//			}
// 			else 
// 			{
// 				print_r("Attention : $class service is down");
 //			}
	}
	
cf197d4f   Benjamin Renard   Fix bug when DDBA...
75
?>