From 805d6b6eaa2c29819ce3dfcce550e57e59610a99 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 24 Oct 2013 14:11:59 +0000 Subject: [PATCH] Nombre de lignes + correction chemin des fichiers --- fileRecv.php | 4 ++++ fileSend.php | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fileRecv.php b/fileRecv.php index 0eed82a..16154d8 100644 --- a/fileRecv.php +++ b/fileRecv.php @@ -97,6 +97,9 @@ if ( $result->count() > 0 ) { if ( copy($source, $dest) ) { + $lines = file($source); + $nbLines = count($lines); + chown($dest, $item->client); $fluxM->update(array( @@ -108,6 +111,7 @@ if ( $result->count() > 0 ) { $txt.= "Client : ".$item->client."\n"; $txt.= "Mode de transmission : ".$item->depotType."\n"; $txt.= "Fichier : ".$item->fileOut."\n"; + $txt.= "Nombre de Lignes : $nbLines\n"; $mail = new Zend_Mail('UTF-8'); $tr = new Zend_Mail_Transport_Sendmail(); diff --git a/fileSend.php b/fileSend.php index d36d55a..9eb6a84 100644 --- a/fileSend.php +++ b/fileSend.php @@ -100,9 +100,12 @@ if ( isset($opts->file) ) $extensionLength = 0; if ($extension!='') { $extensionLength = strlen($extension)+1; + $filename = substr($filename, 0, strlen($filename)-$extensionLength); + $filename = $filename . '_' . date('YmdHis') . '.' . $extension; + } else { + $filename = $filename . '_' . date('YmdHis'); } - $filename = substr($filename, 0, $extensionLength); - $filename = $filename . '_' . date('YmdHis') . '.' . $extension ; + } //Prepare mail @@ -157,7 +160,7 @@ if ( isset($opts->file) ) DIRECTORY_SEPARATOR . 'send'; if ( !is_dir($destDir) ) { - mkdir($destDir, null, true); + mkdir($destDir, 0755, true); } if ( copy($opts->file, $destDir. DIRECTORY_SEPARATOR . $filename) ) {