webservice/bin/buildCodeSfr.php
2017-02-28 12:26:29 +01:00

48 lines
1011 B
PHP

<?php
require_once __DIR__ . '/../application/bin.bootstrap.php';
// --- Options
$displayUsage = false;
try {
$opts = new Zend_Console_Getopt(array(
'help|?' => "Aide.",
'compile-s' => "Génére le cache des règles, sans paramètres (tout), avec paramètres (VORD, VORP, PO)",
'version=s' => "Version des régles",
));
$opts->parse();
$optionsNb = count($opts->getOptions());
} catch (Zend_Console_Getopt_Exception $e) {
$displayUsage = true;
}
// --- Aide / Options
if ($optionsNb == 0 || isset($opts->help)) {
$displayUsage = true;
}
// --- Usage
if ($displayUsage) {
echo "\nRegles SFR\n\n";
echo $opts->getUsageMessage();
exit;
}
$types = array('VORD', 'VORP', 'PO');
if ( $opts->compile!='' && in_array($opts->compile, $types) ) {
$types = array($opts->compile);
}
if ( count($types) > 0 ) {
foreach ( $types as $type ) {
$ruleSfrM = new Metier_Sfr_Compile($conn);
$ruleSfrM->setVersion($opts->version);
$ruleSfrM->construct($type);
}
}