Définition des chemins et enregistrement dans la bdd
This commit is contained in:
parent
202e840745
commit
cb62af6a96
41
application/Bootstrap.php
Normal file
41
application/Bootstrap.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
protected function _initConfig()
|
||||
{
|
||||
$config = new Zend_Config($this->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);
|
||||
}*/
|
||||
}
|
||||
}
|
21
fileRecv.php
21
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);
|
||||
|
15
fileSend.php
15
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');
|
||||
|
@ -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
|
||||
|
68
scripts/build/configure.php
Normal file
68
scripts/build/configure.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
// Define path to application directory
|
||||
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(),
|
||||
)));
|
||||
|
||||
//Copy configuration
|
||||
$configDir = realpath(dirname(__FILE__)).'/config';
|
||||
$appconfigDir = APPLICATION_PATH.'/configs';
|
||||
|
||||
if (stristr(PHP_OS, 'WIN')) {
|
||||
$hostname = 'development';
|
||||
} else {
|
||||
$hostname = exec('echo $(hostname)');
|
||||
}
|
||||
|
||||
if ( !copy($configDir.'/'.$hostname.'/application.ini', $appconfigDir.'/application.ini') ) {
|
||||
echo "application.ini could not be copied !\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
/** Zend_Application */
|
||||
require_once 'Zend/Application.php';
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
);
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "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 {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user