Blame view

php/RemoteDataCenter/makeProxy.php 1.17 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
	
9c0d113f   Elena.Budnik   IMPEX final
16
17
18
19
	if (! file_exists(DATAPATH."/RemoteData/Bases.xml"))
		exit('No Bases.xml file'.PHP_EOL);
		
   if (!defined('SimuTargetsXml'))
bf74fc2d   Elena.Budnik   IMPEX
20
21
		exit('SimuTargetsXml is not defined in config.php'.PHP_EOL);
 
8c1fef65   Elena.Budnik   make remote proxy...
22
	if (file_exists(SimuTargetsXml)) rename(SimuTargetsXml, SimuTargetsXml.".bak");
9c0d113f   Elena.Budnik   IMPEX final
23
24
25
26
27
	
	$basesDom = new DomDocument("1.0");
	$basesDom->load(DATAPATH."/RemoteData/Bases.xml");
	
	$bases = $basesDom->getElementsByTagName("dataCenter");
bf74fc2d   Elena.Budnik   IMPEX
28
		
9c0d113f   Elena.Budnik   IMPEX final
29
30
31
32
33
34
35
36
37
	// $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...
38
39
40
41
42
43
44
45
46
47
			if ($center->monitor())
			{
				$center->initProxy();
				$center->makeProxy();
				$center->saveProxy();
			}
			else 
			{
				print_r("Attention : $class service is down");
			}
9c0d113f   Elena.Budnik   IMPEX final
48
		}
bf74fc2d   Elena.Budnik   IMPEX
49
50
51
	}
	
?>