2011-02-03 15:04:40 +01:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
2011-02-07 15:50:52 +01:00
|
|
|
//error_reporting(E_ALL & ~E_NOTICE);
|
2011-02-03 15:04:40 +01:00
|
|
|
|
|
|
|
// Define path to application directory
|
|
|
|
defined('APPLICATION_PATH')
|
|
|
|
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
|
|
|
|
|
|
|
// Define application environment
|
|
|
|
defined('APPLICATION_ENV')
|
|
|
|
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
|
|
|
|
|
|
|
// Ensure library/ is on include_path
|
|
|
|
set_include_path(implode(PATH_SEPARATOR, array(
|
|
|
|
realpath(APPLICATION_PATH . '/../library'),
|
|
|
|
get_include_path(),
|
|
|
|
)));
|
|
|
|
|
|
|
|
/** Zend_Application */
|
|
|
|
require_once 'Zend/Application.php';
|
|
|
|
|
|
|
|
// Create application, bootstrap, and run
|
|
|
|
$application = new Zend_Application(
|
|
|
|
APPLICATION_ENV,
|
|
|
|
APPLICATION_PATH . '/configs/application.ini'
|
|
|
|
);
|
|
|
|
|
|
|
|
require_once realpath(dirname(__FILE__)).'/../config/config.php';
|
|
|
|
|
|
|
|
try {
|
|
|
|
$opts = new Zend_Console_Getopt(
|
|
|
|
//Options
|
|
|
|
array(
|
|
|
|
'help|?' => "Displays usage information.",
|
2011-02-07 15:50:52 +01:00
|
|
|
'all' => "Créer les WSDL à l'installation.",
|
2011-02-03 15:04:40 +01:00
|
|
|
'version=s' => "Re-Créer le WSDL associé à la version X.X.X",
|
2011-02-07 15:50:52 +01:00
|
|
|
'host=s' => "Le nom de domaine à requéter pour générer les WSDL correctement (sans http://)."
|
2011-02-03 15:04:40 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
$opts->parse();
|
|
|
|
} catch (Zend_Console_Getopt_Exception $e) {
|
|
|
|
echo $e->getUsageMessage();
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Usage
|
|
|
|
if(isset($opts->help))
|
|
|
|
{
|
|
|
|
echo $opts->getUsageMessage();
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Génération des WSDL
|
2011-02-07 15:50:52 +01:00
|
|
|
if (isset($opts->all) && isset($opts->host))
|
|
|
|
{
|
|
|
|
$configServiceVersions = new Zend_Config_Ini('WsScore/Entreprise/Versions.ini');
|
|
|
|
foreach( $configServiceVersions->toArray() as $section => $params ){
|
|
|
|
$version = $section;
|
|
|
|
echo "Version $version";
|
|
|
|
if ($params['actif']==1){
|
|
|
|
echo " Traitement...\n";
|
|
|
|
echo genereWSDL($opts->host, $version);
|
|
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
}
|
2011-02-03 15:04:40 +01:00
|
|
|
}
|
|
|
|
|
2011-02-07 15:50:52 +01:00
|
|
|
if (isset($opts->version) && isset($opts->host)){
|
|
|
|
echo genereWSDL($opts->host, $opts->version);
|
|
|
|
echo "\n";
|
|
|
|
}
|
2011-02-03 15:04:40 +01:00
|
|
|
|
2011-02-07 15:50:52 +01:00
|
|
|
function genereWSDL($host, $version){
|
|
|
|
$uri = 'http://'.$host.'/entreprise/v'.$version.'?wsdl-generate';
|
|
|
|
$client = new Zend_Http_Client($uri, array(
|
|
|
|
'adapter' => 'Zend_Http_Client_Adapter_Curl',
|
|
|
|
));
|
|
|
|
$response = $client->request('GET');
|
|
|
|
return $response->getBody();
|
|
|
|
}
|
2011-02-03 15:04:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|