Nouvelles options

This commit is contained in:
Michael RICOIS 2015-03-31 06:44:13 +00:00
parent 7ea58800b4
commit 409758e4f5
5 changed files with 76 additions and 43 deletions

View File

@ -5,7 +5,10 @@ return array(
array(
'name' => 'FICH_RCE',
'type' => 'SFTP',
'options' => array(),
'in' => array(
'CopyDeleteAfter' => true,
),
'out' => array(),
),
),
),
@ -14,11 +17,12 @@ return array(
array(
'name' => 'GEFACTO',
'type' => 'SFTP',
'options' => array(
'in' => array(
'RunWithEndFile' => true,
'CopyAddDate' => true,
'CopyDeleteAfter' => true,
),
'out' => array(),
),
),
),
@ -27,9 +31,10 @@ return array(
array(
'name' => 'RAPPORT',
'type' => 'FTP',
'options' => array(
'in' => array(
'CopyDeleteAfter' => true,
),
'out' => array(),
),
),
),
@ -38,10 +43,11 @@ return array(
array(
'name' => 'EXTRANET',
'type' => 'FTP',
'options' => array(
'in' => array(
'CopyDeleteAfter' => true,
'NoLog' => true,
),
'out' => array(),
),
),
),
@ -50,7 +56,8 @@ return array(
array(
'name' => 'HEXAVIA',
'type' => 'FTP',
'options' => array(),
'in' => array(),
'out' => array(),
),
),
),
@ -59,11 +66,27 @@ return array(
array(
'name' => 'PDF',
'type' => 'FTP',
'options' => array(
'in' => array(
'CopyDeleteAfter' => true,
'NoLog' => true,
),
'out' => array(),
),
),
),
'orone' => array(
'prestations' => array(
array(
'name' => 'XML',
'type' => 'FTP',
'in' => array(),
'out' => array(),
),
array(
'name' => 'PDF',
'type' => 'FTP',
'in' => array(),
'out' => array(),
),
),
)
);

View File

@ -108,17 +108,26 @@ if ( $result->count() > 0 ) {
// Match prestation
$prestations = include __DIR__ . '/fileConfig.php';
if (array_key_exists($client, $prestations))
$prestation = null;
if (array_key_exists($item->client, $prestations))
{
$clientPrestations = $prestations[$client]['prestations'];
$clientPrestations = $prestations[$item->client]['prestations'];
foreach ($clientPrestations as $i => $p)
{
if ($item->depotType == $p['type'] && $item->name == $p['name'])
// Not default repository dir
if (array_key_exists('directory', $p) && !empty($p['directory']))
{
$repositoryDir = $p['directory'];
}
if ($item->depotType == $p['type'] && $fluxRepository == $repositoryDir)
{
$prestation = $p['name'];
// Set option
if (array_key_exists('options', $p) && count($p['options']) > 0)
if (array_key_exists('out', $p) && count($p['out']) > 0)
{
foreach ($p['options'] as $option => $value)
foreach ($p['out'] as $option => $value)
{
${'options'.$option} = $value;
}

View File

@ -94,22 +94,22 @@ if ( isset($opts->file) )
if (array_key_exists($client, $prestations))
{
$clientPrestations = $prestations[$client]['prestations'];
foreach ($clientPrestations as $i => $item)
foreach ($clientPrestations as $i => $p)
{
// Not default repository dir
if (array_key_exists('directory', $item) && !empty($item['directory']))
if (array_key_exists('directory', $p) && !empty($p['directory']))
{
$repositoryDir = $item['directory'];
$repositoryDir = $p['directory'];
}
if ($type == $item['type'] && $fluxRepository == $repositoryDir)
if ($type == $p['type'] && $fluxRepository == $repositoryDir)
{
$prestation = $item['name'];
$prestation = $p['name'];
// Set option
if (array_key_exists('options', $item) && count($item['options']) > 0)
if (array_key_exists('in', $p) && count($p['in']) > 0)
{
foreach ($item['options'] as $option => $value)
foreach ($p['in'] as $option => $value)
{
${'options'.$option} = $value;
}
@ -237,8 +237,9 @@ if ( isset($opts->file) )
{
echo date('Y-m-d H:i:s')." - Copie du fichier $filenameIn dans $destDir\n";
//Execute
if ($optionsNoLog === false) {
// --- Execute
if ($optionsNoLog === false)
{
$db = Zend_Db::factory($c->profil->db->metier);
Zend_Db_Table::setDefaultAdapter($db);
try {
@ -250,7 +251,7 @@ if ( isset($opts->file) )
'depotDate' => $dateFile,
'depotFile' => $filenameOut,
'nbLines' => $nbLines,
'size' => $size,
'depotFileSize' => $size,
'dateInsert' => date('YmdHis'),
'dateExecute' => '0000-00-00 00:00:00', // @todo : dateExecute
));
@ -262,7 +263,7 @@ if ( isset($opts->file) )
}
}
//Suppression des fichiers
// --- Suppression des fichiers
if ($optionsCopyDeleteAfter)
{
unlink( $fluxBasePath . '/' . $filenameIn );

View File

@ -0,0 +1,3 @@
# Gestion des flux a envoyer au client
*/20 4-18 * * * root php /home/batchFlux/fileRecv.php --cron >> /home/log/recv.log 2>&1

View File

@ -1,3 +0,0 @@
# Gestion des flux a envoyer au client
*/10 4-12 * * * root php /home/batchFlux/fileRecv.php --cron