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

View File

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

View File

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

View File

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

View File

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

27
tck.php
View File

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

View File

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