Rev 45 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/** Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M ~/web/eflore-projets/scripts/cli.php iso6391
* -a chargerTous
* Options :
* -t : Permet de tester le script sur un jeux réduit de données (indiquer le nombre de lignes).
*/
class Iso6391 extends EfloreScript {
public function executer() {
// Lancement de l'action demandée
try {
$this->initialiserProjet('iso-639-1');
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerIso6391();
break;
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerIso6391' :
$this->chargerIso6391();
break;
case 'test' :
$this->tester();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
private function tester() {
echo Config::get('test');
}
private function chargerIso6391() {
$chemin = Config::get('chemins.iso6391');
$table = Config::get('tables.iso6391');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY ';' ".
" ENCLOSED BY '\"' ".
" ESCAPED BY '\\\' ".
'IGNORE 0 LINES';
$this->getBdd()->requeter($requete);
}
}
?>