| Line 132... |
Line 132... |
| 132 |
$this->creerFichierDiff();
|
132 |
$this->creerFichierDiff();
|
| 133 |
$this->creerFichierMeta();
|
133 |
$this->creerFichierMeta();
|
| 134 |
}
|
134 |
}
|
| Line 135... |
Line 135... |
| 135 |
|
135 |
|
| - |
|
136 |
private function creerFichierBdnt() {
|
| 136 |
private function creerFichierBdnt() {
|
137 |
$noms =& $this->noms;
|
| 137 |
Debug::printr("Element courrant du tableau des noms : ".print_r(current($this->noms),true));
|
138 |
reset($this->noms);
|
| - |
|
139 |
Debug::printr("Element courrant du tableau des noms : ".count($this->noms).'-'.print_r(current($this->noms),true));
|
| 138 |
//Debug::printr("Taille mémoire du tableau des noms : ".Debug::tailleMemoireVar($this->noms));
|
140 |
|
| 139 |
$this->determinerOrdreDesChamps();
|
141 |
$this->determinerOrdreDesChamps();
|
| Line 140... |
Line 142... |
| 140 |
$this->definirNomDesChamps();
|
142 |
$this->definirNomDesChamps();
|
| 141 |
|
143 |
|
| 142 |
$donnees = array();
|
144 |
$donnees = array();
|
| 143 |
$donnees['champs'] = $this->champs_nom;
|
145 |
$donnees['champs'] = $this->champs_nom;
|
| 144 |
foreach ($this->noms as &$nom) {
|
146 |
foreach ($this->noms as &$nom) {
|
| 145 |
$infos = array();
|
147 |
$infos = array();
|
| 146 |
foreach ($nom as $champ => &$valeur) {
|
148 |
foreach ($nom as $champ => &$valeur) {
|
| 147 |
if (isset($this->champs_ordre[$champ])) {
|
149 |
if (isset($this->champs_ordre[$champ])) {
|
| 148 |
$ordre = $this->champs_ordre[$champ];
|
150 |
$ordre = $this->champs_ordre[$champ];
|
| 149 |
$infos[$ordre] = trim($valeur);
|
151 |
$infos[(int) $ordre] = trim($valeur);
|
| 150 |
} else {
|
152 |
} else {
|
| 151 |
$e = "Le champ '$champ' n'a pas été pris en compte dans l'attribution de l'ordre des champs.";
|
153 |
$e = "Le champ '$champ' n'a pas été pris en compte dans l'attribution de l'ordre des champs.";
|
| 152 |
$this->ajouterMessage($e);
|
154 |
$this->ajouterMessage($e);
|
| - |
|
155 |
}
|
| 153 |
}
|
156 |
}
|
| 154 |
}
|
157 |
ksort($infos);
|
| 155 |
$donnees['noms'][] = $infos;
|
- |
|
| - |
|
158 |
$donnees['noms'][] = $infos;
|
| 156 |
}
|
159 |
}
|
| 157 |
|
160 |
Debug::printr("Dernier element du tableau des noms [trié] : ".print_r($infos,true));
|
| 158 |
$bdnt_tsv = $this->getVue('versionnage/squelettes/bdnt', $donnees, '.tpl.tsv');
|
161 |
$bdnt_tsv = $this->getVue('versionnage/squelettes/bdnt', $donnees, '.tpl.tsv');
|
| Line 159... |
Line 162... |
| 159 |
$this->ecrireFichierBdnt($bdnt_tsv);
|
162 |
$this->ecrireFichierBdnt($bdnt_tsv);
|
| Line 164... |
Line 167... |
| 164 |
$champs_ordre = array_flip($champs_ordre);
|
167 |
$champs_ordre = array_flip($champs_ordre);
|
| 165 |
$nom_courant = current($this->noms);
|
168 |
$nom_courant = current($this->noms);
|
| 166 |
$champs_ordre = $this->attribuerOrdreChampsSupplémentaires($champs_ordre, $nom_courant);
|
169 |
$champs_ordre = $this->attribuerOrdreChampsSupplémentaires($champs_ordre, $nom_courant);
|
| 167 |
asort($champs_ordre);
|
170 |
asort($champs_ordre);
|
| 168 |
$this->champs_ordre = $champs_ordre;
|
171 |
$this->champs_ordre = $champs_ordre;
|
| - |
|
172 |
Debug::printr("Ordre des champs : ".print_r($this->champs_ordre,true));
|
| 169 |
}
|
173 |
}
|
| Line 170... |
Line 174... |
| 170 |
|
174 |
|
| 171 |
private function definirNomDesChamps() {
|
175 |
private function definirNomDesChamps() {
|
| 172 |
$this->champs_nom = array_flip($this->champs_ordre);
|
176 |
$this->champs_nom = array_flip($this->champs_ordre);
|
| Line 181... |
Line 185... |
| 181 |
return $champs_ordre;
|
185 |
return $champs_ordre;
|
| 182 |
}
|
186 |
}
|
| Line 183... |
Line 187... |
| 183 |
|
187 |
|
| 184 |
private function ajouterMessage($message) {
|
188 |
private function ajouterMessage($message) {
|
| 185 |
$titre = self::SCRIPT_NOM.' #'.$this->traitement['id_traitement'];
|
189 |
$titre = self::SCRIPT_NOM.' #'.$this->traitement['id_traitement'];
|
| 186 |
$this->messages[] = array($titre, $message);
|
190 |
$this->messages[] = array('message' => $message, 'resultat' => true);
|
| Line 187... |
Line 191... |
| 187 |
}
|
191 |
}
|
| 188 |
|
192 |
|
| 189 |
private function ecrireFichierBdnt($contenu) {
|
193 |
private function ecrireFichierBdnt($contenu) {
|
| Line 190... |
Line 194... |
| 190 |
$fichier_nom = $this->getBaseNomFichier().'_ref.txt';
|
194 |
$fichier_nom = $this->getBaseNomFichier().$this->manuel['ext_fichier_ref'];
|
| 191 |
$fichier_chemin = Config::get('chemin_referentiel_zip').$fichier_nom;
|
195 |
$fichier_chemin = Config::get('chemin_referentiel_zip').$fichier_nom;
|
| 192 |
|
196 |
|
| 193 |
if ($this->ecrireFichier($fichier_chemin, $contenu)) {
|
197 |
if ($this->ecrireFichier($fichier_chemin, $contenu)) {
|
| 194 |
$this->ajouterMessage("Écriture du fichier bdnt réussie.");
|
198 |
$this->ajouterMessage("Écriture du fichier bdnt réussie.");
|
| 195 |
$this->signature_md5 = md5_file($fichier_chemin);
|
- |
|
| 196 |
$this->ajouterMessage("Signature MD5 du fichier bdnt :".$this->signature_md5);
|
199 |
$this->signature_md5 = md5_file($fichier_chemin);
|
| 197 |
$this->ajouterMessage("Nombre de noms traités : ".count($noms));
|
200 |
$this->ajouterMessage("Signature MD5 du fichier bdnt :".$this->signature_md5);
|
| Line 198... |
Line 201... |
| 198 |
|
201 |
$this->ajouterMessage("Nombre de combinaisons traités : ".$this->noms_stat['combinaison']);
|
| 199 |
}
|
202 |
}
|
| Line 213... |
Line 216... |
| 213 |
return $retour;
|
216 |
return $retour;
|
| 214 |
}
|
217 |
}
|
| Line 215... |
Line 218... |
| 215 |
|
218 |
|
| 216 |
private function creerFichierDiff() {
|
219 |
private function creerFichierDiff() {
|
| 217 |
$derniere_meta = $this->metaDao->getDerniere($this->projet);
|
220 |
$derniere_meta = $this->metaDao->getDerniere($this->projet);
|
| - |
|
221 |
if (is_null($derniere_meta === false)) {
|
| - |
|
222 |
$this->ajouterMessage("Un problème est survenu lors de la récupération des métadonnées précédentes.");
|
| 218 |
if ($derniere_meta === false) {
|
223 |
} else if (is_null($derniere_meta)) {
|
| 219 |
$this->ajouterMessage("Premier versionnage pour ce projet, aucun fichier différentiel ne sera créé.");
|
224 |
$this->ajouterMessage("Premier versionnage pour ce projet, aucun fichier différentiel ne sera créé.");
|
| - |
|
225 |
} else {
|
| 220 |
} else {
|
226 |
Debug::printr("Méta dernier enregistrement : ".print_r($derniere_meta,true));
|
| - |
|
227 |
$code_projet_precedent = strtolower($derniere_meta['code']).'_v'.str_replace('.', '_', $derniere_meta['version']);
|
| 221 |
$code_projet_precedent = strtolower($derniere_meta['code']).'_v'.str_replace('.', '_', $derniere_meta['version']);
|
228 |
Debug::printr("Code projet précédent : $code_projet_precedent");
|
| 222 |
$this->noms_precedents = $this->referentielDao->getTout($code_projet_precedent);
|
229 |
$this->noms_precedents = $this->referentielDao->getTout($code_projet_precedent);
|
| 223 |
$donnees = array();
|
230 |
$donnees = array();
|
| 224 |
$donnees['diff'] = $this->realiserDiff();
|
231 |
$donnees['diff'] = $this->realiserDiff();
|
| 225 |
$donnees['champs'] = $this->champs_nom;
|
232 |
$donnees['champs'] = $this->champs_nom;
|
| Line 239... |
Line 246... |
| 239 |
$diff[$id]['modification_type_2'] = '0';
|
246 |
$diff[$id]['modification_type_2'] = '0';
|
| 240 |
$diff[$id]['modification_type_3'] = '0';
|
247 |
$diff[$id]['modification_type_3'] = '0';
|
| 241 |
$this->noms_stat['modification']++;
|
248 |
$this->noms_stat['modification']++;
|
| 242 |
} else {
|
249 |
} else {
|
| 243 |
$nom_precedent =& $this->noms_precedents[$id];
|
250 |
$nom_precedent =& $this->noms_precedents[$id];
|
| 244 |
$nom_diff = array_diff_assoc($noms, $nom_precedent);
|
251 |
$nom_diff = array_diff_assoc($nom, $nom_precedent);
|
| 245 |
if (count($nom_diff) > 0) {
|
252 |
if (count($nom_diff) > 0) {
|
| 246 |
$this->noms_stat['modification']++;
|
253 |
$this->noms_stat['modification']++;
|
| 247 |
$modif['modification_type'] = 'M';
|
254 |
$modif['modification_type'] = 'M';
|
| 248 |
$modif['modification_type_1'] = '0';
|
255 |
$modif['modification_type_1'] = '0';
|
| 249 |
$modif['modification_type_2'] = '0';
|
256 |
$modif['modification_type_2'] = '0';
|
| Line 279... |
Line 286... |
| 279 |
$type = isset($this->diff_modif_types[$champ_nom]) ? $this->diff_modif_types[$champ_nom] : '3';
|
286 |
$type = isset($this->diff_modif_types[$champ_nom]) ? $this->diff_modif_types[$champ_nom] : '3';
|
| 280 |
return $type;
|
287 |
return $type;
|
| 281 |
}
|
288 |
}
|
| Line 282... |
Line 289... |
| 282 |
|
289 |
|
| 283 |
private function ecrireFichierDiff($contenu) {
|
290 |
private function ecrireFichierDiff($contenu) {
|
| 284 |
$fichier_nom = $this->getBaseNomFichier().'diff.txt';
|
291 |
$fichier_nom = $this->getBaseNomFichier().$this->manuel['ext_fichier_diff'];
|
| Line 285... |
Line 292... |
| 285 |
$fichier_chemin = Config::get('chemin_referentiel_zip').$fichier_nom;
|
292 |
$fichier_chemin = Config::get('chemin_referentiel_zip').$fichier_nom;
|
| 286 |
|
293 |
|
| 287 |
if ($this->ecrireFichier($fichier_chemin, $contenu)) {
|
294 |
if ($this->ecrireFichier($fichier_chemin, $contenu)) {
|
| Line 297... |
Line 304... |
| 297 |
$meta_tsv = $this->getVue('versionnage/squelettes/meta', $donnees, '.tpl.tsv');
|
304 |
$meta_tsv = $this->getVue('versionnage/squelettes/meta', $donnees, '.tpl.tsv');
|
| 298 |
$this->ecrireFichierMeta($meta_tsv);
|
305 |
$this->ecrireFichierMeta($meta_tsv);
|
| 299 |
}
|
306 |
}
|
| Line 300... |
Line 307... |
| 300 |
|
307 |
|
| 301 |
private function ecrireFichierMeta($contenu) {
|
308 |
private function ecrireFichierMeta($contenu) {
|
| 302 |
$fichier_nom = $this->getBaseNomFichier().'_meta.txt';
|
309 |
$fichier_nom = $this->getBaseNomFichier().$this->manuel['ext_fichier_meta'];
|
| Line 303... |
Line 310... |
| 303 |
$fichier_chemin = Config::get('chemin_referentiel_zip').$fichier_nom;
|
310 |
$fichier_chemin = Config::get('chemin_referentiel_zip').$fichier_nom;
|
| 304 |
|
311 |
|
| 305 |
if ($this->ecrireFichier($fichier_chemin, $contenu)) {
|
312 |
if ($this->ecrireFichier($fichier_chemin, $contenu)) {
|
| Line 331... |
Line 338... |
| 331 |
}
|
338 |
}
|
| 332 |
}
|
339 |
}
|
| Line 333... |
Line 340... |
| 333 |
|
340 |
|
| 334 |
private function traiterMessages() {
|
341 |
private function traiterMessages() {
|
| - |
|
342 |
if (isset($this->messages)) {
|
| 335 |
if (isset($this->messages)) {
|
343 |
$num_message = 1;
|
| - |
|
344 |
foreach ($this->messages as $message) {
|
| 336 |
foreach ($this->messages as $message) {
|
345 |
$message['nom'] = 'Message #'.$num_message++;
|
| 337 |
$this->resultatDao->ajouter($this->traitement['id_traitement'], $message);
|
346 |
$this->resultatDao->ajouter($this->traitement['id_traitement'], $message);
|
| 338 |
}
|
347 |
}
|
| 339 |
}
|
348 |
}
|
| 340 |
}
|
349 |
}
|