From 78b20d7b86db786c784d9c6f3ec90cb19fcad9c3 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 28 Aug 2013 10:23:01 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20configuration=20+=20modif=20cl=C3=A9=20?= =?UTF-8?q?bdd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileRecv.php | 22 ++++++------- fileSend.php | 8 ++--- scripts/build/Ftp/application.ini | 37 ++++++++++++++++++++++ scripts/build/application.ini | 52 ------------------------------- 4 files changed, 52 insertions(+), 67 deletions(-) create mode 100644 scripts/build/Ftp/application.ini delete mode 100644 scripts/build/application.ini diff --git a/fileRecv.php b/fileRecv.php index c621dbf..793564e 100644 --- a/fileRecv.php +++ b/fileRecv.php @@ -1,7 +1,7 @@ Client - * Attention le script doit s'executer avec l'utilisateur root, afin de lire le fichier même + * Attention le script doit s'executer avec l'utilisateur root, afin de lire le fichier même * s'il n'a pas les droits */ @@ -58,10 +58,10 @@ $sql = $fluxM->select()->where('dateEnd!=?','0000-00-00 00:00:00'); //Get specific file if ( isset($opts->file) && isset($opts->client) ) { $sql->where('client=?', $opts->client) - ->where('fileOut=?', $opts->file); + ->where('fileOut=?', $opts->file); } else { $sql->where('dateEnd!=?', '0000-00-00 00:00:00'); - $sql->where('dateDepot=?', '0000-00-00 00:00:00'); + $sql->where('depotDate=?', '0000-00-00 00:00:00'); } $result = $fluxM->fetchAll($sql); @@ -73,27 +73,27 @@ if ( $result->count() > 0 ) { DIRECTORY_SEPARATOR . $item->client . DIRECTORY_SEPARATOR . 'recv' . DIRECTORY_SEPARATOR . $item->fileOut; - + switch ($item->typeDepot) { case 'FTP': - $dest = $c->profil->path->ftp . + $dest = $c->profil->path->ftp . DIRECTORY_SEPARATOR . $item->client . DIRECTORY_SEPARATOR . 'recv' . DIRECTORY_SEPARATOR . $item->fileOut; break; case 'SFTP': - $dest = $c->profil->path->sftp . + $dest = $c->profil->path->sftp . DIRECTORY_SEPARATOR . $item->client . DIRECTORY_SEPARATOR . 'recv' . DIRECTORY_SEPARATOR . $item->fileOut; - break; + break; } if ( copy($source, $dest) ) { $fluxM->update(array( - 'dateDepot' => date('YmdHis'), - ), 'id='.$item->id); + 'depotDate' => date('YmdHis'), + ), 'id='.$item->id); } - - } + + } } diff --git a/fileSend.php b/fileSend.php index 09ab116..75c46ed 100644 --- a/fileSend.php +++ b/fileSend.php @@ -63,7 +63,7 @@ if ( isset($opts->file) ) $client = basename(dirname($pathParts['dirname'])); $dateFile = date('YmdHis', filectime($opts->file)); - $startpos = strlen("/home/data/"); + $startpos = strlen( $c->profil->path->data . DIRECTORY_SEPARATOR ); if ( 'sftp' == substr($opts->file,$startpos,4) ) { $type = 'SFTP'; } elseif ( 'ftp' == substr($opts->file,$startpos,3) ) { @@ -132,9 +132,9 @@ if ( isset($opts->file) ) $fluxM->insert(array( 'client' => $client, 'name' => $prestation, - 'typeDepot' => $type, - 'dateDepot' => $dateFile, - 'fileDepot' => $filename, + 'depotType' => $type, + 'depotDate' => $dateFile, + 'depotFile' => $filename, 'nbLines' => $nbLines, 'dateInsert' => date('YmdHis'), 'dateExecute' => '0000-00-00 00:00:00', diff --git a/scripts/build/Ftp/application.ini b/scripts/build/Ftp/application.ini new file mode 100644 index 0000000..cee8290 --- /dev/null +++ b/scripts/build/Ftp/application.ini @@ -0,0 +1,37 @@ +[production] +phpSettings.date.timezone = "Europe/Paris" +phpSettings.display_startup_errors = 0 +phpSettings.display_errors = 0 +bootstrap.path = APPLICATION_PATH "/Bootstrap.php" +bootstrap.class = "Bootstrap" +appnamespace = "Application" +resources.frontController.params.displayExceptions = 0 +resources.layout.layout = "main" +resources.layout.layoutPath = APPLICATION_PATH "/views" +resources.view.basePath = APPLICATION_PATH "/views" +autoloaderNamespaces[] = "Application_" +autoloaderNamespaces[] = "Scores_" +autoloaderNamespaces[] = "Metier_" + +; Scores configuration +profil.path.data = "/home/data" +profil.path.storage = "/home/data/storage" +; Database configuration +profil.db.metier.adapter=mysqli +profil.db.metier.params.host=192.168.3.30 +profil.db.metier.params.username=batchuser +profil.db.metier.params.password=2XQTpKatBVRezXE9 +profil.db.metier.params.dbname=sdv1 +profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" + +[staging : production] +resources.frontController.params.displayExceptions = 1 + +[development : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 +resources.frontController.params.displayExceptions = 1 + +[testing : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 \ No newline at end of file diff --git a/scripts/build/application.ini b/scripts/build/application.ini deleted file mode 100644 index b913885..0000000 --- a/scripts/build/application.ini +++ /dev/null @@ -1,52 +0,0 @@ -[production] -phpSettings.date.timezone = "Europe/Paris" -phpSettings.display_startup_errors = 0 -phpSettings.display_errors = 0 -bootstrap.path = APPLICATION_PATH "/Bootstrap.php" -bootstrap.class = "Bootstrap" -appnamespace = "Application" -resources.session.save_path = APPLICATION_PATH "/../data/sessions" -resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" -resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth" -resources.frontController.params.displayExceptions = 0 -resources.layout.layout = "main" -resources.layout.layoutPath = APPLICATION_PATH "/views" -resources.view.basePath = APPLICATION_PATH "/views" -autoloaderNamespaces[] = "Application_" -autoloaderNamespaces[] = "Scores_" -autoloaderNamespaces[] = "Metier_" - -; Scores configuration -profil.server.name = development -profil.mail.method = smtp -profil.mail.smtp_host = smtp.free.fr -profil.mail.email.support = supportdev@scores-decisions.com -profil.mail.email.supportdev = supportdev@scores-decisions.com -profil.mail.email.contact = supportdev@scores-decisions.com -profil.mail.email.production = supportdev@scores-decisions.com -profil.path.batch = APPLICATION_PATH "/../scripts/jobs" -profil.path.cache = APPLICATION_PATH "/../data/cache" -profil.path.files = APPLICATION_PATH "/../data/files" -profil.path.log = APPLICATION_PATH "/../data/log" -profil.path.data = "c:\Users\mricois\www\data\ws" -profil.path.secure = "c:\Users\mricois\www\data\ws" - -; Database configuration - For old configuration - see Configure.php -profil.db.metier.adapter=mysqli -profil.db.metier.params.host=192.168.78.230 -profil.db.metier.params.username=wsuser -profil.db.metier.params.password=scores -profil.db.metier.params.dbname=sdv1 -profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" - -[staging : production] -resources.frontController.params.displayExceptions = 1 - -[development : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 -resources.frontController.params.displayExceptions = 1 - -[testing : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 \ No newline at end of file