Add options NoLog to get file without save it in database

This commit is contained in:
Michael RICOIS 2014-10-07 08:30:01 +00:00
parent 19b6bf6fd9
commit 6a4e805282
5 changed files with 35 additions and 21 deletions

1
README
View File

@ -24,3 +24,4 @@ Options list
- CopyAddDate - Copy file and add a timestamp to the end of the filename
- CopyDeleteAfter - After copying the file delete it in repository
- RunWithEndFile - Only execute action when we receive file with extension .fin or .end
- NoLOg - Don't log transfert

View File

@ -33,4 +33,16 @@ return array(
),
),
),
'bilansext' => array(
'prestations' => array(
array(
'name' => 'EXTRANET',
'type' => 'FTP',
'options' => array(
'CopyDeleteAfter' => true,
'NoLog' => true,
),
),
),
),
);

View File

@ -57,6 +57,7 @@ if ( isset($opts->file) )
$optionsCopyAddDate = false;
$optionsCopyDeleteAfter = false;
$optionsRunWithEndFile = false;
$optionsNoLog = false;
$repositoryDir = 'send';
$c = new Zend_Config($application->getOptions());
@ -231,25 +232,27 @@ if ( isset($opts->file) )
echo date('Y-m-d H:i:s')." - Copie du fichier $filenameIn dans $destDir\n";
//Execute
$db = Zend_Db::factory($c->profil->db->metier);
Zend_Db_Table::setDefaultAdapter($db);
try {
$fluxM = new Application_Model_Sdv1FluxFileIn();
$fluxM->insert(array(
'client' => $client,
'name' => $prestation,
'depotType' => $type,
'depotDate' => $dateFile,
'depotFile' => $filenameOut,
'nbLines' => $nbLines,
'dateInsert' => date('YmdHis'),
'dateExecute' => '0000-00-00 00:00:00',
));
echo date('Y-m-d H:i:s')." - Enregistrement client:$client fichier:$filenameOut\n";
}
catch (Zend_Db_Exception $e)
{
echo date('Y-m-d H:i:s')." - ERREUR Enregistrement client:$client fichier:$filenameOut\n";
if ($optionsNoLog === false) {
$db = Zend_Db::factory($c->profil->db->metier);
Zend_Db_Table::setDefaultAdapter($db);
try {
$fluxM = new Application_Model_Sdv1FluxFileIn();
$fluxM->insert(array(
'client' => $client,
'name' => $prestation,
'depotType' => $type,
'depotDate' => $dateFile,
'depotFile' => $filenameOut,
'nbLines' => $nbLines,
'dateInsert' => date('YmdHis'),
'dateExecute' => '0000-00-00 00:00:00',
));
echo date('Y-m-d H:i:s')." - Enregistrement client:$client fichier:$filenameOut\n";
}
catch (Zend_Db_Exception $e)
{
echo date('Y-m-d H:i:s')." - ERREUR Enregistrement client:$client fichier:$filenameOut\n";
}
}
//Suppression des fichiers

View File

@ -1 +0,0 @@
/home/data/sftp/gefacto/send IN_CLOSE_WRITE php /home/batchFlux/fileSend.php --debug --file $@/$#

View File

@ -1 +0,0 @@
/home/data/sftp/sfrbtr/send IN_CLOSE_WRITE php /home/batchFlux/fileSend.php --debug --file $@/$#