Use Doctrine/DBAL in place of Zend_Db
This commit is contained in:
parent
1218dd36cd
commit
178cef5c8a
@ -18,8 +18,8 @@ $displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Aide.",
|
||||
'list' => "List item.",
|
||||
'generate|g=s' => "Generate the specify cache.",
|
||||
'list' => "List item.",
|
||||
'generate|g=s' => "Generate the specify cache.",
|
||||
));
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
@ -62,26 +62,45 @@ if ( $opts->list ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Database
|
||||
$c = new Zend_Config($this->getOptions());
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
$connectionParams = array(
|
||||
'dbname' => $c->profil->db->metier->params->dbname,
|
||||
'user' => $c->profil->db->metier->params->username,
|
||||
'password' => $c->profil->db->metier->params->password,
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'charset' => 'utf8',
|
||||
'driver' => 'pdo_mysql',
|
||||
);
|
||||
|
||||
try {
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
echo "Connection Database impossible.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache des Tribunaux Bodacc
|
||||
*/
|
||||
if( $opts->generate == 'Tribunaux' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/BodaccTribunaux.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/BodaccTribunaux.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
foreach($rows as $item) {
|
||||
$dep = intval(substr($item->triCP,0,2));
|
||||
if ($dep==97 || $dep==98) $dep=intval(substr($item->triCP,0,3));
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($result as $item) {
|
||||
$dep = intval(substr($item->triCP, 0, 2));
|
||||
if ($dep == 97 || $dep == 98) {
|
||||
$dep = intval(substr($item->triCP, 0, 3));
|
||||
}
|
||||
fwrite($fp, "\t'" . $item->triCode . "' => array(");
|
||||
fwrite($fp, "'nom'=>\"" . $item->triNom . "\", 'siret'=>\"".$item->triSiret."\", 'dep'=>\"".$dep."\"");
|
||||
fwrite($fp, "),\n");
|
||||
@ -95,18 +114,16 @@ if( $opts->generate == 'Tribunaux' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'FctDir' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
|
||||
$result = $db->query("SELECT codeFct, libelle FROM jo.bodacc_fonctions");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
$sql = "SELECT codeFct, libelle FROM jo.bodacc_fonctions";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/FctDir.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t'" . intval($item->codeFct) . "' => \"". $item->libelle . "\",\n");
|
||||
}
|
||||
@ -119,18 +136,16 @@ if ( $opts->generate == 'FctDir' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'Evenements' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/Evenements.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/Evenements.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t'" . intval($item->codEven) . "' => array(\n");
|
||||
|
||||
@ -151,18 +166,16 @@ if ( $opts->generate == 'Evenements' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'Devises' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/Devises.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/Devises.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t\"" . $item->libDeviseBodacc . "\" => \"" . $item->devIso ."\",\n");
|
||||
}
|
||||
@ -175,18 +188,16 @@ if ( $opts->generate == 'Devises' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'RncsTribunaux' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT triNumGreffe, triNom, triId, triCode FROM jo.tribunaux WHERE triNumGreffe IS NOT NULL";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT triNumGreffe, triNom, triId, triCode FROM jo.tribunaux WHERE triNumGreffe IS NOT NULL");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/RncsTribunaux.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/RncsTribunaux.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t" . intval($item->triNumGreffe) . " => array(");
|
||||
fwrite($fp, "'Id'=>\"" . $item->triId . "\", 'Nom'=>\"".$item->triNom."\", 'Code'=>\"".$item->triCode."\"");
|
||||
@ -201,18 +212,16 @@ if ( $opts->generate == 'RncsTribunaux' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'DevisesInpi' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT devInpi, devIso FROM jo.tabDevises WHERE devInpi>0 ORDER BY devInpi ASC";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT devInpi, devIso FROM jo.tabDevises WHERE devInpi>0 ORDER BY devInpi ASC");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/DevisesInpi.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/DevisesInpi.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t" . intval($item->devInpi) . " => \"" . $item->devIso . "\",\n");
|
||||
}
|
||||
@ -225,18 +234,16 @@ if ( $opts->generate == 'DevisesInpi' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'Jugements' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT codJugement, codEven FROM jo.tabJugeRncs";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT codJugement, codEven FROM jo.tabJugeRncs");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/Jugements.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/Jugements.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t" . intval($item->codJugement) . " => " . $item->codEven . ",\n");
|
||||
}
|
||||
@ -249,18 +256,16 @@ if ( $opts->generate == 'Jugements' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'PaysInpi' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT codePaysInpi, codPays FROM jo.tabPays WHERE codePaysInpi>0 ORDER BY codePaysInpi ASC";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT codePaysInpi, codPays FROM jo.tabPays WHERE codePaysInpi>0 ORDER BY codePaysInpi ASC");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/PaysInpi.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/PaysInpi.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t" . intval($item->codePaysInpi) . " => \"" . $item->codPays . "\",\n");
|
||||
}
|
||||
@ -273,29 +278,27 @@ if ( $opts->generate == 'PaysInpi' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'CodesNaf' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT codNaf700 AS naf, libNaf700 AS LibNaf FROM jo.tabNaf4";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNaf.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNaf.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
|
||||
$result = $db->query("SELECT codNaf700 AS naf, libNaf700 AS LibNaf FROM jo.tabNaf4");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf . "\",\n");
|
||||
}
|
||||
}
|
||||
|
||||
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
$sql = "SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf. "\",\n");
|
||||
}
|
||||
@ -309,18 +312,16 @@ if ( $opts->generate == 'CodesNaf' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'CodesNace' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNace.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNace.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->codNaf1 . preg_replace('/^0/','',substr($item->naf,0,4)) . "\",\n");
|
||||
}
|
||||
@ -333,18 +334,16 @@ if ( $opts->generate == 'CodesNace' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'CodesNafa' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT codNafa AS nafa, libNafa FROM jo.tabNafa";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT codNafa AS nafa, libNafa FROM jo.tabNafa");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNafa.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesNafa.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t'" . $item->nafa . "' => \"" . $item->libNafa ."\",\n");
|
||||
}
|
||||
@ -357,18 +356,16 @@ if ( $opts->generate == 'CodesNafa' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'CodesFJ' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT code AS FJ, libelle AS libFJ FROM jo.tabFJur WHERE code>=1000";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT code AS FJ, libelle AS libFJ FROM jo.tabFJur WHERE code>=1000");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesFJ.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/CodesFJ.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t" . $item->FJ . " => \"" . str_replace('"','\"',$item->libFJ) ."\",\n");
|
||||
}
|
||||
@ -382,18 +379,16 @@ if ( $opts->generate == 'CodesFJ' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'AffairesTypes' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
$sql = "SELECT code, label FROM jo.greffes_affaires_nature";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$result = $db->query("SELECT code, label FROM jo.greffes_affaires_nature");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
|
||||
$fp=fopen(APPLICATION_PATH . '/../library/Metier/Table/AffairesTypes.php','w');
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Table/AffairesTypes.php','w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t'" . $item->code . "' => \"" . $item->label ."\",\n");
|
||||
}
|
||||
@ -406,18 +401,16 @@ if ( $opts->generate == 'AffairesTypes' ) {
|
||||
*/
|
||||
if ( $opts->generate == 'ProcolDelete' ) {
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
|
||||
$result = $db->query("SELECT codEven, affProcol FROM jo.tabEvenements WHERE affProcol>0");
|
||||
$result->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$rows = $result->fetchAll();
|
||||
$sql = "SELECT codEven, affProcol FROM jo.tabEvenements WHERE affProcol>0";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$fp = fopen(APPLICATION_PATH . '/../library/Metier/Defaillance/ProcolDelete.php', 'w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "return array(\n");
|
||||
|
||||
if ( count($rows) > 0 ) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
foreach($rows as $item) {
|
||||
fwrite($fp, "\t" . $item->codEven . " => " . $item->affProcol .",\n");
|
||||
}
|
||||
|
@ -55,11 +55,11 @@ Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
define('LOG_PATH' , $c->profil->path->shared.'/log');
|
||||
|
||||
if (isset($opts->ratios)){
|
||||
if (isset($opts->ratios)) {
|
||||
genereCacheRatios();
|
||||
}
|
||||
|
||||
if ( isset($opts->formules) ) {
|
||||
if (isset($opts->formules)) {
|
||||
|
||||
if ( isset($opts->type) && in_array($opts->type, array('score', 'valo')) ) {
|
||||
$type = $opts->type;
|
||||
|
@ -38,15 +38,33 @@ if ($displayUsage) {
|
||||
}
|
||||
|
||||
if ($opts->log) {
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table::setDefaultAdapter($db);
|
||||
$sql = $db->select()->from('logs_item', '*', 'sdv1');
|
||||
$stmt = $db->query($sql);
|
||||
// Database
|
||||
$c = new Zend_Config($this->getOptions());
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
$connectionParams = array(
|
||||
'dbname' => $c->profil->db->metier->params->dbname,
|
||||
'user' => $c->profil->db->metier->params->username,
|
||||
'password' => $c->profil->db->metier->params->password,
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'charset' => 'utf8',
|
||||
'driver' => 'pdo_mysql',
|
||||
);
|
||||
|
||||
try {
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
echo "Connection Database impossible.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM sdv1.logs_item";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
$outPath = APPLICATION_PATH . '/../library/Scores/Account/Log/List.php';
|
||||
$outFile = $outPath . '/Config.php';
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
|
||||
file_put_contents($outFile, "<?php\n");
|
||||
file_put_contents($outFile, "/* Auto generated ".date('Y-m-d H:i:s')." */\n");
|
||||
file_put_contents($outFile, "return array(\n", FILE_APPEND);
|
||||
@ -59,7 +77,6 @@ if ($opts->log) {
|
||||
}
|
||||
file_put_contents($outFile, ");\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user