Simplification et Harmonization

This commit is contained in:
Michael RICOIS 2017-03-02 14:17:33 +01:00
parent 48a68828df
commit 8ce26eea1c
10 changed files with 110 additions and 98 deletions

35
scripts/build/incron.php → buidIncron.php Normal file → Executable file
View File

@ -8,32 +8,35 @@ defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// --- Composer autoload // --- Composer autoload
require_once realpath(__DIR__ . '/../../vendor/autoload.php'); require_once realpath(__DIR__ . '/vendor/autoload.php');
// --- Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap()->run(); $application->bootstrap()->run();
// --- Options
$displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt( $opts = new Zend_Console_Getopt(array(
//Options 'help|?' => "Display usage information.",
array( 'list' => "List client and prestations.",
'help|?' => "Display usage information.", 'generate' => "Generate",
'list' => "List client and prestations.", 'send=s' => "Generate send incron file [client]/[name]",
'generate' => "Generate", 'read=s' => "Generate read incron file [client]/[name]",
'send=s' => "Generate send incron file [client]/[name]", ));
'read=s' => "Generate read incron file [client]/[name]",
)
);
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage(); $displayUsage = true;
exit;
} }
//Usage // --- Aide / Options
if(isset($opts->help)) if ($optsNb == 0 || isset($opts->help)) {
{ $displayUsage = true;
}
// --- Usage
if ($displayUsage) {
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
exit; exit;
} }

View File

@ -13,24 +13,27 @@ require_once realpath(__DIR__ . '/vendor/autoload.php');
// --- Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// --- Options
$displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt( $opts = new Zend_Console_Getopt(array(
//Options 'help|?' => "Displays usage information.",
array( 'cron' => "Mandatory option with cron",
'help|?' => "Displays usage information.", 'verbose|v' => "Affichage de ce qui est fait."
'cron' => "Mandatory option with cron", ));
'verbose|v' => "Affichage de ce qui est fait."
)
);
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage(); $displayUsage = true;
exit;
} }
//Usage // --- Aide / Options
if( isset($opts->help) || count($opts->getOptions())==0 ) if ($optsNb == 0 || isset($opts->help)) {
{ $displayUsage = true;
}
// --- Usage
if ($displayUsage) {
echo "Clean directories.\n"; echo "Clean directories.\n";
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
exit; exit;

View File

@ -22,12 +22,13 @@ try {
'verbose|v' => "Affichage de ce qui est fait." 'verbose|v' => "Affichage de ce qui est fait."
)); ));
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
$displayUsage = true; $displayUsage = true;
} }
// --- Aide / Options // --- Aide / Options
if (count($opts->getOptions())==0 || isset($opts->help)) { if ($optsNb == 0 || isset($opts->help)) {
$displayUsage = true; $displayUsage = true;
} }

View File

@ -17,24 +17,27 @@ require_once realpath(__DIR__ . '/vendor/autoload.php');
// --- Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// --- Options
$displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt( $opts = new Zend_Console_Getopt(array(
//Options 'help|?' => "Displays usage information.",
array( 'file|f=s' => "Give the full file path to integrate",
'help|?' => "Displays usage information.", 'debug' => "Send a mail for debug",
'file|f=s' => "Give the full file path to integrate", ));
'debug' => "Send a mail for debug",
)
);
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage(); $displayUsage = true;
exit; }
// --- Aide / Options
if ($optsNb == 0 || isset($opts->help)) {
$displayUsage = true;
} }
// --- Usage // --- Usage
if( isset($opts->help) || count($opts->getOptions())==0 ) if ($displayUsage) {
{
echo "Execute basic action when a customer read a file.\n"; echo "Execute basic action when a customer read a file.\n";
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
exit; exit;

View File

@ -19,26 +19,29 @@ require_once realpath(__DIR__ . '/vendor/autoload.php');
// --- Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// --- Options
$displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt( $opts = new Zend_Console_Getopt(array(
//Options 'help|?' => "Displays usage information.",
array( 'cron' => "Mandatory option in crontab",
'help|?' => "Displays usage information.", 'file=s' => "Manually define the file to process",
'cron' => "Mandatory option in crontab", 'client=s' => "Define the client name for getting the file manually",
'file=s' => "Manually define the file to process", 'debug' => "Send a mail for debug",
'client=s' => "Define the client name for getting the file manually", ));
'debug' => "Send a mail for debug",
)
);
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage(); $displayUsage = true;
exit; }
// --- Aide / Options
if ($optsNb == 0 || isset($opts->help)) {
$displayUsage = true;
} }
// --- Usage // --- Usage
if( isset($opts->help) || count($opts->getOptions())==0 ) if ($displayUsage) {
{
echo "Place files in right directory for sending to the customer.\n"; echo "Place files in right directory for sending to the customer.\n";
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
exit; exit;

View File

@ -1,6 +0,0 @@
# Gestion des flux a envoyer au client
*/15 4-18 * * * root php /home/flux/current/recv.php --cron >> /home/log/recv.log 2>&1
# Nettoyage
01 18 * * * root php /home/flux/current/clean.php --cron >> /home/log/clean.log 2>&1

View File

@ -1,7 +0,0 @@
/home/log/*.log {
weekly
missingok
rotate 5
compress
notifempty
}

View File

@ -18,25 +18,28 @@ require_once realpath(__DIR__ . '/vendor/autoload.php');
// --- Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// --- Options
$displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt( $opts = new Zend_Console_Getopt(array(
// --- Options 'help|?' => "Displays usage information.",
array( 'file|f=s' => "Give the full file path to integrate",
'help|?' => "Displays usage information.", 'mail' => "Only send a mail when a file is write",
'file|f=s' => "Give the full file path to integrate", 'debug' => "Send a mail for debug",
'mail' => "Only send a mail when a file is write", ));
'debug' => "Send a mail for debug",
)
);
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage(); $displayUsage = true;
exit; }
// --- Aide / Options
if ($optsNb == 0 || isset($opts->help)) {
$displayUsage = true;
} }
// --- Usage // --- Usage
if( isset($opts->help) || count($opts->getOptions())==0 ) if ($displayUsage) {
{
echo "Execute basic action when a customer send a file.\n"; echo "Execute basic action when a customer send a file.\n";
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
exit; exit;

27
tck.php
View File

@ -18,24 +18,27 @@ require_once realpath(__DIR__ . '/vendor/autoload.php');
// --- Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// --- Options
$displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt( $opts = new Zend_Console_Getopt(array(
//Options 'help|?' => "Displays usage information.",
array( 'file|f=s' => "Give the full file path to integrate",
'help|?' => "Displays usage information.", 'debug' => "Send a mail for debug",
'file|f=s' => "Give the full file path to integrate", ));
'debug' => "Send a mail for debug",
)
);
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage(); $displayUsage = true;
exit; }
// --- Aide / Options
if ($optsNb == 0 || isset($opts->help)) {
$displayUsage = true;
} }
// --- Usage // --- Usage
if( isset($opts->help) || count($opts->getOptions())==0 ) if ($displayUsage) {
{
echo "Mark as transfert.\n"; echo "Mark as transfert.\n";
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
exit; exit;

View File

@ -13,6 +13,8 @@ require_once realpath(__DIR__ . '/vendor/autoload.php');
// --- Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// --- Options
$displayUsage = false;
try { try {
// --- Options // --- Options
$opts = new Zend_Console_Getopt(array( $opts = new Zend_Console_Getopt(array(
@ -21,14 +23,18 @@ try {
'event=s' => "Event", 'event=s' => "Event",
)); ));
$opts->parse(); $opts->parse();
$optsNb = $opts->getOptions();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage(); $displayUsage = true;
exit; }
// --- Aide / Options
if ($optsNb == 0 || isset($opts->help)) {
$displayUsage = true;
} }
// --- Usage // --- Usage
if( isset($opts->help) || count($opts->getOptions())==0 ) if ($displayUsage) {
{
echo "Proxy Event Trigger.\n"; echo "Proxy Event Trigger.\n";
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
exit; exit;