makeSpeasyProxy.php 953 Bytes
<?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';
		}
	}
	
	$AMDA_IHM = getenv('AMDA_IHM');
     
	require_once $AMDA_IHM."/php/config.php"; 
	
	$BasesXml = $AMDA_IHM."/php/RemoteDataCenter/Bases.xml";
	
	if (!file_exists($BasesXml)) 
		exit('No Bases.xml file'.PHP_EOL);
		
 	$basesDom = new DomDocument("1.0");
	$basesDom->load($BasesXml);
	
	$bases = $basesDom->getElementsByTagName("dataCenter");
		
	foreach ($bases as $base)
	{	
        echo $base->getAttribute('xml:id').PHP_EOL;
		if ($base->hasAttribute('isSpeasyProxy'))
		{
			$class = $base->getAttribute('xml:id');
			echo PHP_EOL.$class.PHP_EOL;
			$center = new $class();

			if ($center->monitor())
			{
				$center->makeProxy();
			}
			else 
			{
				echo "[ERROR] $class service is not available".PHP_EOL;
			}
		}
	}
?>