Blame view

php/RemoteDataCenter/makeProxy.php 1.22 KB
bf74fc2d   Elena.Budnik   IMPEX
1
2
3
4
5
6
7
8
9
10
11
<?php
/*
*  Executable to make 'base.xml' proxies for IMPEX centers from IMPEX original trees
*/

	if (!function_exists('__autoload')) {
		function __autoload($class_name) {
					require_once $class_name . '.php';
		}
	}
	
9c0d113f   Elena.Budnik   IMPEX final
12
13
14
	$AMDA_IHM = getenv('AMDA_IHM');
     
	require_once $AMDA_IHM."/php/config.php"; 
bf74fc2d   Elena.Budnik   IMPEX
15
	
fd2b603f   Elena.Budnik   Bases.xml are in ...
16
17
18
19
	$BasesXml = $AMDA_IHM."/php/RemoteDataCenter/Bases.xml";
	
	if (!file_exists($BasesXml)) 
		exit('No Bases.xml file for IMPEX'.PHP_EOL);
9c0d113f   Elena.Budnik   IMPEX final
20
21
		
   if (!defined('SimuTargetsXml'))
bf74fc2d   Elena.Budnik   IMPEX
22
23
		exit('SimuTargetsXml is not defined in config.php'.PHP_EOL);
 
8c1fef65   Elena.Budnik   make remote proxy...
24
	if (file_exists(SimuTargetsXml)) rename(SimuTargetsXml, SimuTargetsXml.".bak");
9c0d113f   Elena.Budnik   IMPEX final
25
26
	
	$basesDom = new DomDocument("1.0");
fd2b603f   Elena.Budnik   Bases.xml are in ...
27
	$basesDom->load($BasesXml);
9c0d113f   Elena.Budnik   IMPEX final
28
29
	
	$bases = $basesDom->getElementsByTagName("dataCenter");
bf74fc2d   Elena.Budnik   IMPEX
30
		
9c0d113f   Elena.Budnik   IMPEX final
31
32
33
34
35
36
37
38
39
	// $bases = array("IPIM", "LATMOS", "FMI_HYBRID", "FMI_GUMICS", "SINP", "LESIA");
	 	 
	foreach ($bases as $base)
	{	
		if ($base->hasAttribute('isSimulation'))
		{
			$class = $base->getAttribute('xml:id');
			echo PHP_EOL.$class.PHP_EOL;
			$center = new $class();
8c1fef65   Elena.Budnik   make remote proxy...
40
41
42
43
44
45
46
47
			if ($center->monitor())
			{
				$center->initProxy();
				$center->makeProxy();
				$center->saveProxy();
			}
			else 
			{
9b6c46d9   Elena.Budnik   THEMIS Remote center
48
				print_r("Attention : $class service is down or has connection problems");
8c1fef65   Elena.Budnik   make remote proxy...
49
			}
9c0d113f   Elena.Budnik   IMPEX final
50
		}
bf74fc2d   Elena.Budnik   IMPEX
51
	}
bf74fc2d   Elena.Budnik   IMPEX
52
?>