Subversion Repositories eFlore/Applications.cel

Rev

Rev 2895 | Rev 3296 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2895 Rev 2936
Line 20... Line 20...
20
 * @copyright  1999-2016 Tela Botanica <accueil@tela-botanica.org>
20
 * @copyright  1999-2016 Tela Botanica <accueil@tela-botanica.org>
21
 */
21
 */
22
class Nettoyage extends Script {
22
class Nettoyage extends Script {
Line 23... Line 23...
23
 
23
 
-
 
24
	protected $bdd;
Line 24... Line 25...
24
	protected $bdd;
25
	protected $colonnes;
25
 
26
 
26
 
27
 
27
	public function __construct($script_nom, $parametres_cli) {
28
	public function __construct($script_nom, $parametres_cli) {
Line 28... Line 29...
28
		parent::__construct($script_nom, $parametres_cli);
29
		parent::__construct($script_nom, $parametres_cli);
29
		$this->bdd = new Bdd();
30
		$this->bdd = new Bdd();
-
 
31
	}
-
 
32
 
30
	}
33
	public function executer() {
31
 
34
		$cmd = $this->getParametre('a');
32
	public function executer() {
35
		$requete_colonnes = "SELECT column_name FROM information_schema.columns WHERE table_name = 'cel_obs' AND table_schema='tb_cel';";
-
 
36
		$this->colonnes = $this->bdd->recupererTous($requete_colonnes);
33
		$cmd = $this->getParametre('a');
37
		try {
-
 
38
			switch ($cmd) {
34
		try {
39
				case 'tout' :
35
			switch ($cmd) {
40
					$this->supprimerRetourLigne();
36
				case 'tout' :
41
					$this->supprimerAntislash();
37
					$this->supprimerAntislash();
42
					$this->supprimerGuillement();
38
					$this->unifierNomReferentiel();
43
					$this->unifierNomReferentiel();
Line 71... Line 76...
71
			$this->traiterErreur($e->getMessage());
76
			$this->traiterErreur($e->getMessage());
72
		}
77
		}
73
	}
78
	}
Line -... Line 79...
-
 
79
	
-
 
80
 
-
 
81
	private function supprimerRetourLigne() {		
-
 
82
		foreach ($this->colonnes as $id=>$colonne) {
-
 
83
			echo "Suppression des retour ligne dans la colonne ".$colonne['column_name']." ...";
-
 
84
			$requete = "UPDATE cel_obs SET ".$colonne['column_name']." = REPLACE(".$colonne['column_name'].', "\n", "")';
-
 
85
			$this->bdd->requeter($requete);
-
 
86
			echo "effectuée \n";
Line 74... Line 87...
74
	
87
		}
75
 
-
 
76
	
-
 
77
	private function supprimerAntislash() {
88
	}
78
		$requete_colonnes = "SELECT column_name FROM information_schema.columns WHERE table_name = 'cel_obs' AND table_schema='tb_cel';";
89
	
79
		$colonnes = $this->bdd->recupererTous($requete_colonnes); 
90
	private function supprimerAntislash() {
-
 
91
		foreach ($this->colonnes as $id=>$colonne) {
-
 
92
			echo "Suppression des antislash dans la colonne ".$colonne['column_name']." ...";
-
 
93
			$requete = "UPDATE cel_obs SET ".$colonne['column_name']." = REPLACE(".$colonne['column_name'].', "\", "")';
-
 
94
			$this->bdd->requeter($requete);
-
 
95
			echo "effectuée \n";
-
 
96
		}
-
 
97
	}
-
 
98
	
-
 
99
	private function supprimerGuillemet() {
80
		foreach ($colonnes as $id=>$colonne) {
100
		foreach ($this->colonnes as $id=>$colonne) {
81
			echo "Suppression des antislash dans la colonne ".$colonne['column_name']." ...";
101
			echo "Suppression des guillements dans la colonne ".$colonne['column_name']." ...";
82
			$requete = "UPDATE cel_obs SET ".$colonne['column_name']." = REPLACE(".$colonne['column_name'].', "\\\", "")';
102
			$requete = "UPDATE cel_obs SET ".$colonne['column_name']." = REPLACE(".$colonne['column_name'].',"\"", "")';
83
			$this->bdd->requeter($requete);
103
			$this->bdd->requeter($requete);