Line 23... |
Line 23... |
23 |
|
23 |
|
24 |
protected $bdd;
|
24 |
protected $bdd;
|
25 |
protected $colonnes;
|
25 |
protected $colonnes;
|
26 |
protected $bd_cel = "tb_nettoye_cel";
|
26 |
protected $bd_cel = "tb_nettoye_cel";
|
- |
|
27 |
protected $bd_del = "tb_del";
|
Line 27... |
Line 28... |
27 |
protected $bd_del = "tb_del";
|
28 |
protected $bd_flore = "tb_eflore";
|
28 |
|
29 |
|
29 |
|
30 |
|
30 |
public function __construct($script_nom, $parametres_cli) {
|
31 |
public function __construct($script_nom, $parametres_cli) {
|
31 |
parent::__construct($script_nom, $parametres_cli);
|
32 |
parent::__construct($script_nom, $parametres_cli);
|
- |
|
33 |
$this->bdd = new Bdd();
|
32 |
$this->bdd = new Bdd();
|
34 |
$this->bd_cel = Config::get('nettoyage.cel_nettoye');
|
Line 33... |
Line 35... |
33 |
$this->bd_cel = Config::get('nettoyage.cel_nettoye');
|
35 |
$this->bd_del = Config::get('nettoyage.del');
|
34 |
$this->bd_del = Config::get('nettoyage.del');
|
36 |
$this->bd_flore = Config::get('nettoyage.flore');
|
35 |
}
|
37 |
}
|
Line 45... |
Line 47... |
45 |
$this->supprimerAntislash();
|
47 |
$this->supprimerAntislash();
|
46 |
$this->supprimerGuillemet();
|
48 |
$this->supprimerGuillemet();
|
47 |
$this->unifierNull();
|
49 |
$this->unifierNull();
|
48 |
$this->unifierNomReferentiel();
|
50 |
$this->unifierNomReferentiel();
|
49 |
$this->unifierCertitude();
|
51 |
$this->unifierCertitude();
|
50 |
$this->supprimerCertitudeAutre();
|
52 |
//$this->supprimerCertitudeAutre();
|
51 |
$this->unifierUtilisateur();
|
53 |
$this->unifierUtilisateur();
|
52 |
$this->unifierPhenologie();
|
54 |
$this->unifierPhenologie();
|
53 |
$this->verifierCodeInsee();
|
55 |
$this->verifierCodeInsee();
|
54 |
$this->verifierGeodatum();
|
56 |
$this->verifierGeodatum();
|
55 |
$this->supprimerInfosLiesObsInexistante();
|
57 |
$this->supprimerInfosLiesObsInexistante();
|
Line 99... |
Line 101... |
99 |
break;
|
101 |
break;
|
100 |
case 'unifierUtilisateur' :
|
102 |
case 'unifierUtilisateur' :
|
101 |
$this->unifierUtilisateur();
|
103 |
$this->unifierUtilisateur();
|
102 |
break;
|
104 |
break;
|
103 |
case 'unifierInfosEspece' :
|
105 |
case 'unifierInfosEspece' :
|
104 |
$this->unifierUtilisateur();
|
106 |
$this->unifierInfosEspeces();
|
105 |
break;
|
107 |
break;
|
106 |
case 'unifierPhenologie' :
|
108 |
case 'unifierPhenologie' :
|
107 |
$this->unifierPhenologie();
|
109 |
$this->unifierPhenologie();
|
108 |
break;
|
110 |
break;
|
109 |
default :
|
111 |
default :
|
Line 637... |
Line 639... |
637 |
OR `id_mot_cle` NOT IN (SELECT `id_mot_cle` FROM ".$this->bd_cel.".`cel_arbre_mots_cles_images`);";
|
639 |
OR `id_mot_cle` NOT IN (SELECT `id_mot_cle` FROM ".$this->bd_cel.".`cel_arbre_mots_cles_images`);";
|
638 |
$this->bdd->requeter($requete_anonyme);
|
640 |
$this->bdd->requeter($requete_anonyme);
|
639 |
}
|
641 |
}
|
640 |
}
|
642 |
}
|
Line -... |
Line 643... |
- |
|
643 |
|
- |
|
644 |
private function unifierInfosEspeces() {
|
- |
|
645 |
echo "maj infos espèces \n";
|
- |
|
646 |
/*$requete = "ALTER TABLE ".$this->bd_cel.".`cel_obs` ADD infosnn varchar(2),
|
- |
|
647 |
ADD bd_nom_sci varchar(250), ADD bd_num_nom int(11), ADD bd_nom_sci_retenu varchar(250),
|
- |
|
648 |
ADD bd_num_nom_retenu int(11) ;";
|
- |
|
649 |
$this->bdd->requeter($requete);
|
- |
|
650 |
*/
|
- |
|
651 |
$liste_referentiels = array("bdtfx" => "bdtfx_v6_00", "bdtre" => "bdtre_v1_00",
|
- |
|
652 |
"isfan" => "isfan_v2013", "apd" => "apd_v3_4_0", "bdtxa" => "bdtxa_v1_01",
|
- |
|
653 |
"aublet" => "aublet_v2016_09", "florical" => "florical_v2016_04_22", "lbf" => "lbf_v1_00");
|
- |
|
654 |
|
- |
|
655 |
$this->unifierInfosEspecesBDTFX();
|
- |
|
656 |
foreach ($liste_referentiels as $ref => $version) {
|
- |
|
657 |
//Num nom et nom sci sont les mêmes
|
- |
|
658 |
// chercher les versions
|
- |
|
659 |
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`
|
- |
|
660 |
join (SELECT `num_nom`, `num_nom_retenu`, `nom_sci`,
|
- |
|
661 |
case when annee = '' THEN concat(`nom_sci`, ' ', auteur) ELSE concat(`nom_sci`, ' ', auteur, ' [',annee,']') END as nom_sci_complet,
|
- |
|
662 |
nom_sci_complet_ret FROM ".$this->bd_flore.".".$version.
|
- |
|
663 |
|
- |
|
664 |
'left join (select `num_nom` as nn, `nom_sci` as nom_sci_ret,
|
- |
|
665 |
case when annee = "" THEN concat(`nom_sci`, " ", auteur) ELSE concat(`nom_sci`, " ", auteur, " [",annee,"]") END as nom_sci_complet_ret
|
- |
|
666 |
from ".$this->bd_flore.".".$version." where `num_nom` = `num_nom_retenu`) ret
|
- |
|
667 |
on `num_nom_retenu` = nn) bdtfx
|
- |
|
668 |
on `nom_sel_nn` = num_nom and `nom_sel` like concat(nom_sci,"%")
|
- |
|
669 |
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom , `nom_ret` = nom_sci_complet_ret, `nom_ret_nn` = num_nom_retenu,
|
- |
|
670 |
infosnn = 1
|
- |
|
671 |
WHERE nom_referentiel = "'.$ref.'"';
|
- |
|
672 |
$this->bdd->requeter($requete);
|
- |
|
673 |
|
- |
|
674 |
//Num nom id, nom sci !=
|
- |
|
675 |
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`
|
- |
|
676 |
join (SELECT `num_nom`, `num_nom_retenu`, `nom_sci`,
|
- |
|
677 |
case when annee = '' THEN concat(`nom_sci`, ' ', auteur) ELSE concat(`nom_sci`, ' ', auteur, ' [',annee,']') END as nom_sci_complet,
|
- |
|
678 |
nom_sci_complet_ret FROM ".$this->bd_flore.".".$version.
|
- |
|
679 |
|
- |
|
680 |
'left join (select `num_nom` as nn, `nom_sci` as nom_sci_ret,
|
- |
|
681 |
case when annee = "" THEN concat(`nom_sci`, " ", auteur) ELSE concat(`nom_sci`, " ", auteur, " [",annee,"]") END as nom_sci_complet_ret
|
- |
|
682 |
from ".$this->bd_flore.".".$version." where `num_nom` = `num_nom_retenu`) ret
|
- |
|
683 |
on `num_nom_retenu` = nn) bdtfx
|
- |
|
684 |
on `nom_sel_nn` = num_nom and and (nom_sel like concat(nom_sci,"%") and nom_ret like concat(nom_sci,"%"))
|
- |
|
685 |
and (nom_sel like concat(nom_sci_ret,"%") and nom_ret like concat(nom_sci_ret,"%"))
|
- |
|
686 |
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom , `nom_ret` = nom_sci_complet_ret, `nom_ret_nn` = num_nom_retenu,
|
- |
|
687 |
infosnn = 2
|
- |
|
688 |
WHERE nom_referentiel = "'.$ref.'" and infosnn != 1';
|
- |
|
689 |
$this->bdd->requeter($requete);
|
- |
|
690 |
//
|
- |
|
691 |
}
|
- |
|
692 |
}
|
- |
|
693 |
|
- |
|
694 |
private function unifierInfosEspecesBDTFX() {
|
- |
|
695 |
echo "maj infos espèces \n";
|
- |
|
696 |
/*$requete = "ALTER TABLE ".$this->bd_cel.".`cel_obs` ADD infosnn varchar(2),
|
- |
|
697 |
ADD bd_nom_sci varchar(250), ADD bd_num_nom int(11), ADD bd_nom_sci_retenu varchar(250),
|
- |
|
698 |
ADD bd_num_nom_retenu int(11) ;";
|
- |
|
699 |
$this->bdd->requeter($requete);
|
- |
|
700 |
*/
|
- |
|
701 |
|
- |
|
702 |
//Num nom et nom sci sont les mêmes
|
- |
|
703 |
// chercher les versions
|
- |
|
704 |
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`"
|
- |
|
705 |
.' join bdtfx on `nom_sel_nn` = num_nom and `nom_sel` like concat(nom_sci, "%")
|
- |
|
706 |
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom ,
|
- |
|
707 |
`nom_ret` = nom_ret_complet, `nom_ret_nn` = num_nom_retenu,
|
- |
|
708 |
infosnn = 1
|
- |
|
709 |
where `nom_referentiel` = "bdtfx" ';
|
- |
|
710 |
$this->bdd->requeter($requete);
|
- |
|
711 |
|
- |
|
712 |
//Num nom id, nom sci +-=
|
- |
|
713 |
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`"
|
- |
|
714 |
.' join bdtfx on `nom_sel_nn` = num_nom and and (nom_sel like concat(nom_sci,"%") and nom_ret like concat(nom_sci,"%"))
|
- |
|
715 |
and (nom_sel like concat(nom_sci_ret,"%") and nom_ret like concat(nom_sci_ret,"%"))
|
- |
|
716 |
SET `nom_sel` = nom_sci_complet, `nom_sel_nn` = num_nom ,
|
- |
|
717 |
`nom_ret` = nom_ret_complet, `nom_ret_nn` = num_nom_retenu,
|
- |
|
718 |
infosnn = 2
|
- |
|
719 |
where `nom_referentiel` = "bdtfx" and infosnn != "1"';
|
- |
|
720 |
$this->bdd->requeter($requete);
|
- |
|
721 |
|
- |
|
722 |
//Num nom id, nom sci +-=
|
- |
|
723 |
$requete = "UPDATE ".$this->bd_cel.".`cel_obs`"
|
- |
|
724 |
.' join bdtfx on `nom_sel_nn` = num_nom and and (nom_sel not like concat(nom_sci,"%") and nom_ret not like concat(nom_sci,"%"))
|
- |
|
725 |
and (nom_sel not like concat(nom_sci_ret,"%") and nom_ret not like concat(nom_sci_ret,"%"))
|
- |
|
726 |
SET `bd_nom_sci` = nom_sci_complet, `bd_num_nom` = num_nom ,
|
- |
|
727 |
`bd_nom_sci_retenu` = nom_ret_complet, `bd_num_nom_retenu` = num_nom_retenu,
|
- |
|
728 |
infosnn = 3
|
- |
|
729 |
where `nom_referentiel` = "bdtfx" and infosnn not in ("1", "2")';
|
- |
|
730 |
$this->bdd->requeter($requete);
|
- |
|
731 |
}
|
641 |
|
732 |
|
642 |
private function supprimerImagesetTagAnonymes() {
|
733 |
private function supprimerImagesetTagAnonymes() {
|
643 |
echo "vérification de la présence de l'annuaire \n";
|
734 |
echo "vérification de la présence de l'annuaire \n";
|
644 |
$requete = "SELECT * FROM ".$this->bd_cel.".`users`;";
|
735 |
$requete = "SELECT * FROM ".$this->bd_cel.".`users`;";
|
645 |
$result = $this->bdd->requeter($requete);
|
736 |
$result = $this->bdd->requeter($requete);
|
- |
|
737 |
if ($result === NULL) {
|
646 |
if ($result === NULL) {echo $requete;
|
738 |
echo $requete;
|
647 |
echo "Il manque la table annuaire (à recopier de telaorg users\n";
|
739 |
echo "Il manque la table annuaire (à recopier de telaorg users\n";
|
648 |
exit;
|
740 |
exit;
|
Line 649... |
Line 741... |
649 |
}
|
741 |
}
|
650 |
|
742 |
|
651 |
echo "suppression de le colonne ordre \n";
|
743 |
echo "suppression de le colonne ordre \n";
|