X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fenv%2Fmodules%2Fmw_env_sgbds.php;h=97a280a1693566d2306cd1c909a0895915a09eff;hb=refs%2Fheads%2Fmaster;hp=dfdb74f9b76f12d355a3655c00f9784f218debc9;hpb=ad9756b0b72852c82165e824570f21b039fcb359;p=mtweb diff --git a/mw/env/modules/mw_env_sgbds.php b/mw/env/modules/mw_env_sgbds.php index dfdb74f..97a280a 100644 --- a/mw/env/modules/mw_env_sgbds.php +++ b/mw/env/modules/mw_env_sgbds.php @@ -34,6 +34,33 @@ return $this->sgbds; } + public function load_sgbd(){ + if(($data = $this->data()) && $this->bdd("sgbd")){ + $sgbd_impl_file = $this->path("mw_dir")."env/sgbd/mw_".$this->bdd("sgbd").".php"; + if(!file_exists($sgbd_impl_file)){ + $this->erreur("Impossible de trouver le fichier d'implementation du sgbd ".$this->bdd("sgbd"), true); + } + $sgbd_impl = "mw_".$this->bdd("sgbd"); + if(!class_exists($sgbd_impl)) require_once $sgbd_impl_file; + if(!class_exists($sgbd_impl)){ + $this->erreur("Impossible de trouver la classe d'implementation du sgbd ".$this->bdd("sgbd"), true); + } + $sgbd = new $sgbd_impl( + $this, + array( + "host" => $this->bdd("host"), + "base" => $this->bdd("base"), + "user" => $this->bdd("user"), + "password" => $this->bdd("password") + ) + ); + if(!$sgbd->extention_ok()){ + $this->erreur("L'extention php ".$this->bdd("sgbd")." n'est pas installée", true); + } + $data->set_sgbd($sgbd); + } + } + } // -------------------------------------------------------------------------------------------