Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 293 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 293 Rev 348
Line 34... Line 34...
34
		} catch (Exception $e) {
34
		} catch (Exception $e) {
35
			$this->traiterErreur($e->getMessage());
35
			$this->traiterErreur($e->getMessage());
36
		}
36
		}
37
	}
37
	}
Line -... Line 38...
-
 
38
 
-
 
39
	protected function initialiserProjet($projet) {
-
 
40
		$bases = $this->getListeBases();
-
 
41
		parent::initialiserProjet($projet);
-
 
42
		$this->verifierPresenceBdd($bases);
-
 
43
	}
-
 
44
 
-
 
45
	private function getListeBases() {
-
 
46
		$requete = "SHOW DATABASES";
-
 
47
		$bases = $this->getBdd()->recupererTous($requete);
-
 
48
		return $bases;
-
 
49
	}
-
 
50
 
-
 
51
	private function verifierPresenceBdd($bases) {
-
 
52
		$bddNom = Config::get('bdd_nom');
-
 
53
		$existe = false;
-
 
54
		foreach ($bases as $base) {
-
 
55
			if ($base['Database'] == $bddNom) {
-
 
56
				$existe = true;
-
 
57
				break;
-
 
58
			}
-
 
59
		}
-
 
60
		if ($existe === false) {
-
 
61
			$message = "Veuillez créer la base de données '$bddNom'.";
-
 
62
			throw new Exception($message);
-
 
63
		}
-
 
64
	}
38
 
65
 
39
	public function chargerTapirlink() {
66
	private function chargerTapirlink() {
40
		$tablesCodes = array_keys(Config::get('tables'));
67
		$tablesCodes = array_keys(Config::get('tables'));
41
		foreach ($tablesCodes as $code) {
68
		foreach ($tablesCodes as $code) {
42
			echo "Chargement de la table : $code\n";
69
			echo "Chargement de la table : $code\n";
43
			$this->chargerFichierTsvDansTable($code);
70
			$this->chargerFichierTsvDansTable($code);
Line 57... Line 84...
57
			'IGNORE 1 LINES';
84
			'IGNORE 1 LINES';
58
		$this->getBdd()->requeter($requete);
85
		$this->getBdd()->requeter($requete);
59
	}
86
	}
Line 60... Line 87...
60
 
87
 
61
	private function supprimerTous() {
88
	private function supprimerTous() {
62
		$requete = "DROP TABLE cel_images, cel_inventory, cel_mots_cles_images, cel_mots_cles_obs, cel_obs_images, locations";
89
		$requete = "DROP TABLE IF EXISTS raw_occurrence_record ";
63
		$this->getBdd()->requeter($requete);
90
		$this->getBdd()->requeter($requete);
64
	}
91
	}
65
}
92
}
66
?>
93
?>