diff --git a/application/Bootstrap.php b/application/Bootstrap.php new file mode 100644 index 0000000..f4aeadd --- /dev/null +++ b/application/Bootstrap.php @@ -0,0 +1,41 @@ +getOptions()); + Zend_Registry::set('config', $config); + + return $config; + } + + protected function _initDb() + { + $c = Zend_Registry::get('config'); + try { + $db = Zend_Db::factory($c->profil->db->metier); + } catch ( Exception $e ) { + echo "Database !\n"; + exit; + } + + /** + * Set the default adapter to use with all model + */ + Zend_Db_Table::setDefaultAdapter($db); + } + + protected function _initCache() + { + /*if ( APPLICATION_ENV!='development' ) { + //MetadataCache pour la base de données + $frontendOptions = array( + 'lifetime' => 14400, + 'automatic_serialization' => true + ); + $backendOptions = array(); + $cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions); + Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); + }*/ + } +} \ No newline at end of file diff --git a/fileRecv.php b/fileRecv.php index 71d3d12..16b22c6 100644 --- a/fileRecv.php +++ b/fileRecv.php @@ -7,12 +7,16 @@ // Define path to application directory defined('APPLICATION_PATH') - || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application')); + || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application')); + +// Define application environment +defined('APPLICATION_ENV') + || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( - realpath(APPLICATION_PATH . '/../library'), - get_include_path(), + realpath(APPLICATION_PATH . '/../library'), + get_include_path(), ))); /** Zend_Application */ @@ -52,7 +56,7 @@ $c = new Zend_Config($application->getOptions()); $db = Zend_Db::factory($c->profil->metier); Zend_Db_Table::setDefaultAdapter($db); -$fluxM = new Application_Model_Sv1FluxFileOut(); +$fluxM = new Application_Model_Sdv1FluxFileOut(); $sql = $fluxM->select()->where('dateEnd!=?','0000-00-00 00:00:00'); //Get specific file @@ -86,11 +90,20 @@ if ( $result->count() > 0 ) { DIRECTORY_SEPARATOR . $item->client . DIRECTORY_SEPARATOR . 'recv' . DIRECTORY_SEPARATOR . $item->fileOut; + + switch($item->client) { + case 'sfr': + $user = 'sfrbtr'; + break; + } + break; } if ( copy($source, $dest) ) { + chown($dest, $user); + $fluxM->update(array( 'depotDate' => date('YmdHis'), ), 'id='.$item->id); diff --git a/fileSend.php b/fileSend.php index 051645e..990c47e 100644 --- a/fileSend.php +++ b/fileSend.php @@ -8,10 +8,14 @@ defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application')); +// Define application environment +defined('APPLICATION_ENV') + || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); + // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( - realpath(APPLICATION_PATH . '/../library'), - get_include_path(), + realpath(APPLICATION_PATH . '/../library'), + get_include_path(), ))); /** Zend_Application */ @@ -82,6 +86,9 @@ if ( isset($opts->file) ) switch ($client) { case 'sfr' : $prestation = 'FICH_RCE'; + $filemask = array( + 'FICH_RCE_SCORE_*.csv', + ); break; case 'gefacto': $prestation = 'GEFACTO'; @@ -108,8 +115,8 @@ if ( isset($opts->file) ) $txt.= "Fichier : ".$opts->file."\n"; $txt.= "Nombre de Lignes : $nbLines\n"; - $mail = new Zend_Mail(); - $tr = new Zend_Mail_Transport_Sendmail(); + $mail = new Zend_Mail('utf-8'); + $tr = new Zend_Mail_Transport_Smtp('smtp.celeste.fr'); $mail->setDefaultTransport($tr); $mail->setBodyText($txt); $mail->setFrom('supportdev@scores-decisions.com', 'Machine'); diff --git a/scripts/build/Ftp/application.ini b/scripts/build/Ftp/application.ini index cee8290..f204de5 100644 --- a/scripts/build/Ftp/application.ini +++ b/scripts/build/Ftp/application.ini @@ -15,7 +15,8 @@ autoloaderNamespaces[] = "Metier_" ; Scores configuration profil.path.data = "/home/data" -profil.path.storage = "/home/data/storage" +profil.path.storage = "/home/data" + ; Database configuration profil.db.metier.adapter=mysqli profil.db.metier.params.host=192.168.3.30 diff --git a/scripts/build/configure.php b/scripts/build/configure.php new file mode 100644 index 0000000..0cb943d --- /dev/null +++ b/scripts/build/configure.php @@ -0,0 +1,68 @@ + "Display usage information.", + 'install' => "Make install operation.", + ) + ); + $opts->parse(); +} catch (Zend_Console_Getopt_Exception $e) { + echo $e->getUsageMessage(); + exit; +} + +//Usage +if(isset($opts->help)) +{ + echo $opts->getUsageMessage(); + exit; +} + +if(isset($opts->install)) +{ + if (stristr(PHP_OS, 'WIN')) { + + } else { + + } +} diff --git a/scripts/build/incron/sfr b/scripts/build/incron/sfrbtr similarity index 100% rename from scripts/build/incron/sfr rename to scripts/build/incron/sfrbtr