Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 637 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 637 Rev 661
1
<?php
1
<?php
2
//declare(encoding='UTF-8');
2
//declare(encoding='UTF-8');
3
/**
3
/**
4
 * Exemple de lancement du script : :
4
 * Exemple de lancement du script : :
5
 * /opt/lampp/bin/php cli.php bdtxa -a chargerTous
5
 * /opt/lampp/bin/php cli.php bdtxa -a chargerTous
6
 *
6
 *
7
 * @category	php 5.2
7
 * @category	php 5.2
8
 * @package		eFlore/Scripts
8
 * @package		eFlore/Scripts
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @copyright	Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
10
 * @copyright	Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Bdtxa extends EfloreScript {
15
class Bdtxa extends EfloreScript {
16
 
16
 
17
	private $table = null;
17
	private $table = null;
18
	private $pasInsertion = 1000;
18
	private $pasInsertion = 1000;
19
	private $departInsertion = 0;
19
	private $departInsertion = 0;
20
 
20
 
21
	protected $parametres_autorises = array(
21
	protected $parametres_autorises = array(
22
		'-t' => array(false, false, 'Permet de tester le script sur un jeu réduit de données (indiquer le nombre de lignes).'));
22
		'-t' => array(false, false, 'Permet de tester le script sur un jeu réduit de données (indiquer le nombre de lignes).'));
23
 
23
 
24
	public function executer() {
24
	public function executer() {
25
		try {
25
		try {
26
			$this->initialiserProjet('bdtxa');
26
			$this->initialiserProjet('bdtxa');
27
 
27
 
28
			// Lancement de l'action demandée
28
			// Lancement de l'action demandée
29
			$cmd = $this->getParametre('a');
29
			$cmd = $this->getParametre('a');
30
			switch ($cmd) {
30
			switch ($cmd) {
31
				case 'chargerTous' :
31
				case 'chargerTous' :
32
					$this->chargerStructureSql();
32
					$this->chargerStructureSql();
33
					$this->chargerBdtxa();
33
					$this->chargerBdtxa();
34
					$this->genererChpNomSciHtml();
34
					$this->genererChpNomSciHtml();
35
					$this->genererChpFamille();
35
					$this->genererChpFamille();
36
					$this->genererChpNomComplet();
36
					$this->genererChpNomComplet();
37
					break;
37
					break;
38
				case 'chargerStructureSql' :
38
				case 'chargerStructureSql' :
39
					$this->chargerStructureSql();
39
					$this->chargerStructureSql();
40
					break;
40
					break;
41
				case 'chargerBdtxa' :
41
				case 'chargerBdtxa' :
42
					$this->chargerBdtxa();
42
					$this->chargerBdtxa();
43
					break;
43
					break;
44
				case 'genererChpNomSciHtml' :
44
				case 'genererChpNomSciHtml' :
45
					$this->genererChpNomSciHtml();
45
					$this->genererChpNomSciHtml();
46
					break;
46
					break;
47
				case 'genererChpNomComplet' :
47
				case 'genererChpNomComplet' :
48
					$this->initialiserGenerationChamps();
48
					$this->initialiserGenerationChamps();
49
					$this->genererChpNomComplet();
49
					$this->genererChpNomComplet();
50
					break;
50
					break;
51
				case 'genererChpFamille' :
51
				case 'genererChpFamille' :
52
					$this->genererChpFamille();
52
					$this->genererChpFamille();
53
					break;
53
					break;
54
				case 'supprimerTous' :
54
				case 'supprimerTous' :
55
					$this->supprimerTous();
55
					$this->supprimerTous();
56
					break;
56
					break;
57
				default :
57
				default :
58
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
58
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
59
			}
59
			}
60
		} catch (Exception $e) {
60
		} catch (Exception $e) {
61
			$this->traiterErreur($e->getMessage());
61
			$this->traiterErreur($e->getMessage());
62
		}
62
		}
63
	}
63
	}
64
 
64
 
65
	private function chargerBdtxa() {
65
	private function chargerBdtxa() {
66
		$chemin = Config::get('chemins.bdtxa');
66
		$chemin = Config::get('chemins.bdt');
67
		$table = Config::get('tables.bdtxa');
67
		$table = Config::get('tables.bdtxa');
68
		$requete = "LOAD DATA INFILE '$chemin' ".
68
		$requete = "LOAD DATA INFILE '$chemin' ".
69
				"REPLACE INTO TABLE $table ".
69
				"REPLACE INTO TABLE $table ".
70
				'CHARACTER SET utf8 '.
70
				'CHARACTER SET utf8 '.
71
				'FIELDS '.
71
				'FIELDS '.
72
				"	TERMINATED BY '\t' ".
72
				"	TERMINATED BY '\t' ".
73
				"	ENCLOSED BY '' ".
73
				"	ENCLOSED BY '' ".
74
				"	ESCAPED BY '\\\' ".
74
				"	ESCAPED BY '\\\' ".
75
				'IGNORE 1 LINES';
75
				'IGNORE 1 LINES';
76
		$this->getBdd()->requeter($requete);
76
		$this->getBdd()->requeter($requete);
77
	}
77
	}
78
 
78
 
79
	private function genererChpNomSciHtml() {
79
	private function genererChpNomSciHtml() {
80
		$this->initialiserGenerationChamps();
80
		$this->initialiserGenerationChamps();
81
		$this->preparerTablePrChpNomSciHtml();
81
		$this->preparerTablePrChpNomSciHtml();
82
		$generateur = new GenerateurNomSciHtml();
82
		$generateur = new GenerateurNomSciHtml();
83
		$nbreTotal = $this->recupererNbTotalTuples();
83
		$nbreTotal = $this->recupererNbTotalTuples();
-
 
84
		$erreurs = array();
84
		$this->departInsertion = 0;
85
		$this->departInsertion = 0;
85
		while ($this->departInsertion < $nbreTotal) {
86
		while ($this->departInsertion < $nbreTotal) {
86
			$resultat = $this->recupererTuplesPrChpNomSciHtml();
87
			$resultat = $this->recupererTuplesPrChpNomSciHtml();
-
 
88
 
-
 
89
			try {
87
			$nomsSciEnHtml = $generateur->generer($resultat);
90
				$nomsSciEnHtml = $generateur->generer($resultat);
-
 
91
			} catch (Exception $e) {
-
 
92
				$erreurs[] = $e->getMessage();
-
 
93
			}
-
 
94
 
88
			$this->remplirChpNomSciHtm($nomsSciEnHtml);
95
			$this->remplirChpNomSciHtm($nomsSciEnHtml);
89
			$this->departInsertion += $this->pasInsertion;
96
			$this->departInsertion += $this->pasInsertion;
90
			$this->afficherAvancement("Insertion des noms scientifique au format HTML dans la base par paquet de {$this->pasInsertion} en cours");
97
			$this->afficherAvancement("Insertion des noms scientifique au format HTML dans la base par paquet de {$this->pasInsertion} en cours");
91
			if ($this->stopperLaBoucle($this->getParametre('t'))) break;
98
			if ($this->stopperLaBoucle($this->getParametre('t'))) break;
92
		}
99
		}
93
		echo "\n";
100
		echo "\n";
-
 
101
 
-
 
102
		$this->creerFichierLog('Erreurs lors de la génération HTML des noms scientifiques', $erreurs, 'erreurs_noms_sci_html');
94
	}
103
	}
95
 
104
 
96
	private function initialiserGenerationChamps() {
105
	private function initialiserGenerationChamps() {
97
		$this->table = Config::get('tables.bdtxa');
106
		$this->table = Config::get('tables.bdtxa');
98
	}
107
	}
99
 
108
 
100
	private function preparerTablePrChpNomSciHtml() {
109
	private function preparerTablePrChpNomSciHtml() {
101
		$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'nom_sci_html' ";
110
		$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'nom_sci_html' ";
102
		$resultat = $this->getBdd()->recuperer($requete);
111
		$resultat = $this->getBdd()->recuperer($requete);
103
		if ($resultat === false) {
112
		if ($resultat === false) {
104
			$requete = 	"ALTER TABLE {$this->table} ".
113
			$requete = 	"ALTER TABLE {$this->table} ".
105
					'ADD nom_sci_html VARCHAR( 500 ) '.
114
					'ADD nom_sci_html VARCHAR( 500 ) '.
106
					'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
115
					'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
107
			$this->getBdd()->requeter($requete);
116
			$this->getBdd()->requeter($requete);
108
		}
117
		}
109
	}
118
	}
110
 
119
 
111
	private function recupererNbTotalTuples(){
120
	private function recupererNbTotalTuples(){
112
		$requete = "SELECT count(*) AS nb FROM {$this->table} ";
121
		$requete = "SELECT count(*) AS nb FROM {$this->table} ";
113
		$resultat = $this->getBdd()->recuperer($requete);
122
		$resultat = $this->getBdd()->recuperer($requete);
114
		return $resultat['nb'];
123
		return $resultat['nb'];
115
	}
124
	}
116
 
125
 
117
	private function recupererTuplesPrChpNomSciHtml() {
126
	private function recupererTuplesPrChpNomSciHtml() {
118
		$requete = 'SELECT 	num_nom, rang, nom_supra_generique, genre, epithete_infra_generique, '.
127
		$requete = 'SELECT 	num_nom, rang, nom_supra_generique, genre, epithete_infra_generique, '.
119
				'	epithete_sp, type_epithete, epithete_infra_sp,cultivar_groupe, '.
128
				'	epithete_sp, type_epithete, epithete_infra_sp,cultivar_groupe, '.
120
				'	nom_commercial, cultivar '.
129
				'	nom_commercial, cultivar '.
121
				"FROM {$this->table} ".
130
				"FROM {$this->table} ".
122
				"LIMIT {$this->departInsertion},{$this->pasInsertion} ";
131
				"LIMIT {$this->departInsertion},{$this->pasInsertion} ";
123
		$resultat = $this->getBdd()->recupererTous($requete);
132
		$resultat = $this->getBdd()->recupererTous($requete);
124
		return $resultat;
133
		return $resultat;
125
	}
134
	}
126
 
135
 
127
	private function remplirChpNomSciHtm($nomsSciHtm) {
136
	private function remplirChpNomSciHtm($nomsSciHtm) {
128
		foreach ($nomsSciHtm as $id => $html) {
137
		foreach ($nomsSciHtm as $id => $html) {
129
			$html = $this->getBdd()->proteger($html);
138
			$html = $this->getBdd()->proteger($html);
130
			$requete = "UPDATE {$this->table} SET nom_sci_html = $html WHERE num_nom = $id ";
139
			$requete = "UPDATE {$this->table} SET nom_sci_html = $html WHERE num_nom = $id ";
131
			$resultat = $this->getBdd()->requeter($requete);
140
			$resultat = $this->getBdd()->requeter($requete);
132
			if ($resultat === false) {
141
			if ($resultat === false) {
133
				throw new Exception("Erreur d'insertion pour le tuple $id");
142
				throw new Exception("Erreur d'insertion pour le tuple $id");
134
			}
143
			}
135
		}
144
		}
136
	}
145
	}
137
	
146
 
138
	private function genererChpNomComplet() {
147
	private function genererChpNomComplet() {
139
		$this->preparerTablePrChpNomComplet();
148
		$this->preparerTablePrChpNomComplet();
140
		$this->remplirChpNomComplet();
149
		$this->remplirChpNomComplet();
141
	}
150
	}
142
	
151
 
143
	private function preparerTablePrChpNomComplet() {
152
	private function preparerTablePrChpNomComplet() {
144
		$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'nom_complet' ";
153
		$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'nom_complet' ";
145
		$resultat = $this->getBdd()->recuperer($requete);
154
		$resultat = $this->getBdd()->recuperer($requete);
146
		if ($resultat === false) {
155
		if ($resultat === false) {
147
			$requete = 	"ALTER TABLE {$this->table} ".
156
			$requete = 	"ALTER TABLE {$this->table} ".
148
						'ADD nom_complet VARCHAR( 500 ) '.
157
						'ADD nom_complet VARCHAR( 500 ) '.
149
						'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
158
						'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
150
			$this->getBdd()->requeter($requete);
159
			$this->getBdd()->requeter($requete);
151
		}
160
		}
152
	}
161
	}
153
	
162
 
154
	private function remplirChpNomComplet() {
163
	private function remplirChpNomComplet() {
155
		$this->afficherAvancement("Attribution du champ nom complet au taxons");
164
		echo "Attribution du champ nom complet au taxons : ";
156
		$requete = "UPDATE {$this->table} SET nom_complet = CONCAT(nom_sci,' ',auteur)";
165
		$requete = "UPDATE {$this->table} SET nom_complet = CONCAT(nom_sci,' ',auteur)";
157
		$resultat = $this->getBdd()->requeter($requete);
166
		$resultat = $this->getBdd()->requeter($requete);
158
		if ($resultat === false) {
167
		if ($resultat === false) {
-
 
168
			echo "KO\n";
159
			throw new Exception("Erreur de génération du champ nom complet");
169
			throw new Exception("Erreur de génération du champ nom complet");
-
 
170
		} else {
-
 
171
			echo "OK\n";
160
		}
172
		}
161
	}
173
	}
162
 
174
 
163
	private function genererChpFamille() {
175
	private function genererChpFamille() {
164
		$this->initialiserGenerationChamps();
176
		$this->initialiserGenerationChamps();
165
		$this->preparerTablePrChpFamille();
177
		$this->preparerTablePrChpFamille();
166
		$resultats = $this->recupererTuplesPrChpFamille();
178
		$resultats = $this->recupererTuplesPrChpFamille();
167
		$noms = array();
179
		$noms = array();
168
		$introuvables = array();
180
		$introuvables = array();
169
		$introuvablesSyno = array();
181
		$introuvablesSyno = array();
170
		foreach ($resultats as $id => $nom) {
182
		foreach ($resultats as $id => $nom) {
171
			$nn = $nom['num_nom'];
183
			$nn = $nom['num_nom'];
172
			$nnr = $nom['num_nom_retenu'];
184
			$nnr = $nom['num_nom_retenu'];
173
			$nts = $nom['num_tax_sup'];
185
			$nts = $nom['num_tax_sup'];
174
			$rg = $nom['rang'];
186
			$rg = $nom['rang'];
175
			if ($nnr != '') {
187
			if ($nnr != '') {
176
				if ($rg == '180') {
188
				if ($rg == '180') {
177
					$noms[$nn] = $nom['nom_sci'];
189
					$noms[$nn] = $nom['nom_sci'];
178
				} else {
190
				} else {
179
					if ($nn == $nnr) {// nom retenu
191
					if ($nn == $nnr) {// nom retenu
180
						if (isset($noms[$nts])) {
192
						if (isset($noms[$nts])) {
181
							$noms[$nn] = $noms[$nts];
193
							$noms[$nn] = $noms[$nts];
182
						} else {
194
						} else {
183
							$introuvables[] = $nn;
195
							$introuvables[] = $nn;
184
						}
196
						}
185
					} else {// nom synonyme
197
					} else {// nom synonyme
186
						if (isset($noms[$nnr])) {
198
						if (isset($noms[$nnr])) {
187
							$noms[$nn] = $noms[$nnr];
199
							$noms[$nn] = $noms[$nnr];
188
						} else {
200
						} else {
189
							$introuvablesSyno[] = $nom;
201
							$introuvablesSyno[] = $nom;
190
						}
202
						}
191
					}
203
					}
192
				}
204
				}
193
			}
205
			}
194
			unset($resultats[$id]);
206
			unset($resultats[$id]);
195
			$this->afficherAvancement("Attribution de leur famille aux noms en cours");
207
			$this->afficherAvancement("Attribution de leur famille aux noms en cours");
196
			if ($this->stopperLaBoucle($this->getParametre('t'))) break;
208
			if ($this->stopperLaBoucle($this->getParametre('t'))) break;
197
		}
209
		}
198
		echo "\n";
210
		echo "\n";
199
 
211
 
200
		foreach ($introuvablesSyno as $id => $nom) {
212
		foreach ($introuvablesSyno as $id => $nom) {
201
			$nn = $nom['num_nom'];
213
			$nn = $nom['num_nom'];
202
			$nnr = $nom['num_nom_retenu'];
214
			$nnr = $nom['num_nom_retenu'];
203
			if (isset($noms[$nnr])) {
215
			if (isset($noms[$nnr])) {
204
				$noms[$nn] = $noms[$nnr];
216
				$noms[$nn] = $noms[$nnr];
205
			} else {
217
			} else {
206
				$introuvables[] = $nn;
218
				$introuvables[] = $nn;
207
			}
219
			}
208
			unset($introuvablesSyno[$id]);
220
			unset($introuvablesSyno[$id]);
209
			$this->afficherAvancement("Attribution de leur famille aux synonymes en cours");
221
			$this->afficherAvancement("Attribution de leur famille aux synonymes en cours");
210
		}
222
		}
211
		echo "\n";
223
		echo "\n";
-
 
224
 
-
 
225
		$msg = 'Plusieurs familles sont introuvables';
-
 
226
		$this->creerFichierLog($msg, $introuvables, 'famille_introuvable');
212
 
-
 
213
		if (count($introuvables) != 0) {
-
 
214
			$introuvablesNbre = count($introuvables);
-
 
215
			echo "Famille introuvable pour $introuvablesNbre noms ! Voir le log.\n";
-
 
216
 
-
 
217
			$logContenu = implode(", \n", $introuvables);
-
 
218
			$logFichier = realpath(dirname(__FILE__)).'/log/famille_introuvable.log';
-
 
219
			echo $logFichier."\n";
-
 
220
			file_put_contents($logFichier, $logContenu);
-
 
221
		}
227
 
222
		$this->remplirChpFamille($noms);
228
		$this->remplirChpFamille($noms);
223
	}
229
	}
224
 
230
 
225
	private function preparerTablePrChpFamille() {
231
	private function preparerTablePrChpFamille() {
226
		$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'famille' ";
232
		$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'famille' ";
227
		$resultat = $this->getBdd()->recuperer($requete);
233
		$resultat = $this->getBdd()->recuperer($requete);
228
		if ($resultat === false) {
234
		if ($resultat === false) {
229
			$requete = 	"ALTER TABLE {$this->table} ".
235
			$requete = 	"ALTER TABLE {$this->table} ".
230
				'ADD famille VARCHAR(255) '.
236
				'ADD famille VARCHAR(255) '.
231
				'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
237
				'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
232
			$this->getBdd()->requeter($requete);
238
			$this->getBdd()->requeter($requete);
233
		}
239
		}
234
	}
240
	}
235
 
241
 
236
	private function recupererTuplesPrChpFamille() {
242
	private function recupererTuplesPrChpFamille() {
237
		$requete = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci '.
243
		$requete = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci '.
238
			"FROM {$this->table} ".
244
			"FROM {$this->table} ".
239
			"WHERE rang >= 180 ".
245
			"WHERE rang >= 180 ".
240
			"ORDER BY rang ASC, num_tax_sup ASC, num_nom_retenu DESC ";
246
			"ORDER BY rang ASC, num_tax_sup ASC, num_nom_retenu DESC ";
241
		$resultat = $this->getBdd()->recupererTous($requete);
247
		$resultat = $this->getBdd()->recupererTous($requete);
242
		return $resultat;
248
		return $resultat;
243
	}
249
	}
244
 
250
 
245
	private function remplirChpFamille($noms) {
251
	private function remplirChpFamille($noms) {
246
		foreach ($noms as $id => $famille) {
252
		foreach ($noms as $id => $famille) {
247
			$famille = $this->getBdd()->proteger($famille);
253
			$famille = $this->getBdd()->proteger($famille);
248
			$requete = "UPDATE {$this->table} SET famille = $famille WHERE num_nom = $id ";
254
			$requete = "UPDATE {$this->table} SET famille = $famille WHERE num_nom = $id ";
249
			$resultat = $this->getBdd()->requeter($requete);
255
			$resultat = $this->getBdd()->requeter($requete);
250
			if ($resultat === false) {
256
			if ($resultat === false) {
251
				throw new Exception("Erreur d'insertion pour le tuple $id");
257
				throw new Exception("Erreur d'insertion pour le tuple $id");
252
			}
258
			}
253
			$this->afficherAvancement("Insertion des noms de famille dans la base en cours");
259
			$this->afficherAvancement("Insertion des noms de famille dans la base en cours");
254
		}
260
		}
255
		echo "\n";
261
		echo "\n";
256
	}
262
	}
257
	private function genererDonneesTestMultiVersion() {
263
	private function genererDonneesTestMultiVersion() {
258
		$contenuSql = $this->recupererContenu(Config::get('chemins.structureSqlTest'));
264
		$contenuSql = $this->recupererContenu(Config::get('chemins.structureSqlTest'));
259
		$this->executerScripSql($contenuSql);
265
		$this->executerScripSql($contenuSql);
260
	
266
 
261
		$table = Config::get('tables.bdtxa');
267
		$table = Config::get('tables.bdtxa');
262
		$tableTest = Config::get('tables.bdtxaTest');
268
		$tableTest = Config::get('tables.bdtxaTest');
263
		$requete = "INSERT INTO $tableTest SELECT * FROM $table";
269
		$requete = "INSERT INTO $tableTest SELECT * FROM $table";
264
		$this->getBdd()->requeter($requete);
270
		$this->getBdd()->requeter($requete);
265
	}
271
	}
266
	
272
 
267
	private function supprimerDonneesTestMultiVersion() {
273
	private function supprimerDonneesTestMultiVersion() {
268
		$tableMeta = Config::get('tables.bdtxaMeta');
274
		$tableMeta = Config::get('tables.bdtxaMeta');
269
		$requete = "DELETE FROM $tableMeta WHERE guid = 'urn:lsid:tela-botanica.org:bdtfx:1.02'";
275
		$requete = "DELETE FROM $tableMeta WHERE guid = 'urn:lsid:tela-botanica.org:bdtxa:1.00'";
270
		$this->getBdd()->requeter($requete);
276
		$this->getBdd()->requeter($requete);
271
	
277
 
272
		$tableTest = Config::get('tables.bdtxaTest');
278
		$tableTest = Config::get('tables.bdtxaTest');
273
		$requete = "DROP TABLE IF EXISTS $tableTest";
279
		$requete = "DROP TABLE IF EXISTS $tableTest";
274
		$this->getBdd()->requeter($requete);
280
		$this->getBdd()->requeter($requete);
275
	}
281
	}
276
	private function supprimerTous() {
282
	private function supprimerTous() {
277
		$requete = "DROP TABLE IF EXISTS bdtxa_meta, bdtxa_v0_01";
283
		$requete = "DROP TABLE IF EXISTS bdtxa_meta, bdtxa_v0_01, bdtxa_v1_00";
278
		$this->getBdd()->requeter($requete);
284
		$this->getBdd()->requeter($requete);
279
	}
285
	}
-
 
286
 
-
 
287
	private function creerFichierLog($message, $lignes, $nomFichier) {
-
 
288
		$lignesNbre = count($lignes);
-
 
289
		if ($lignesNbre != 0) {
-
 
290
			echo "$message. Voir le log de $lignesNbre lignes :\n";
-
 
291
 
-
 
292
			$logContenu = implode(", \n", $lignes);
-
 
293
			$logFichier = realpath(dirname(__FILE__))."/log/$nomFichier.log";
-
 
294
			echo $logFichier."\n";
-
 
295
			file_put_contents($logFichier, $logContenu);
-
 
296
		}
-
 
297
	}
280
}
298
}
281
?>
299
?>