Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 130 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 chargerCel() {
66
	public function chargerCel() {
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";
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() {
-
 
89
		$requete = "DROP TABLE IF EXISTS cel_images, cel_inventory, cel_mots_cles_images, cel_mots_cles_obs, ".
62
		$requete = "DROP TABLE cel_images, cel_inventory, cel_mots_cles_images, cel_mots_cles_obs, cel_obs_images, locations";
90
			"cel_obs_images, locations ";
63
		$this->getBdd()->requeter($requete);
91
		$this->getBdd()->requeter($requete);
64
	}
92
	}
65
}
93
}
66
?>
94
?>