X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fapp%2Finit%2F0300_data.php;h=9d376e2bef67f6dc8ec791d6ff4e92a909c3fabc;hb=4687a79b837722b039f87b5ecce003c67f0001ba;hp=8a28d16b485379e6d6a8c3bd6e86190ed6493819;hpb=36ed114046cbe3d72a3589230e9f306a54fcc79d;p=mtweb diff --git a/mw/app/init/0300_data.php b/mw/app/init/0300_data.php index 8a28d16..9d376e2 100644 --- a/mw/app/init/0300_data.php +++ b/mw/app/init/0300_data.php @@ -1,40 +1,53 @@ app_file("data/mw_sgbd.php"); - require $this->app_file("data/mw_data.php"); - if($this->app_file_exists("data/impl/mw_".$this->bdd("sgbd").".php")){ - require $this->app_file("data/impl/mw_".$this->bdd("sgbd").".php"); - if(class_exists($sgbd_impl = "mw_".$this->bdd("sgbd"))){ - if(($plugins = $this->plugins("DESC")) !== false){ - $data = new mw_data(true); - foreach($plugins as $plugin_name => $plugin){ - if($plugin["installed"] && $plugin["enabled"]){ - $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/share/"); - $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); - } - } - $data->load_modules($this->path("mw_dir")."app/", "data/modules/share/"); - $data->load_modules($this->path("mw_dir")."app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); - $sgbd = new mw_sgbd( - new $sgbd_impl( - $this->bdd("host"), - $this->bdd("base"), - $this->bdd("user"), - $this->bdd("password") - ), - $this - ); - if($sgbd->extention_ok()){ - $data->set_sgbd($sgbd); - $data->set_env($this); - $this->set_data($data); - } - else $this->erreur("L'extention php ".$this->bdd("sgbd")." n'est pas installée", true); - } - else $this->erreur("Impossible de lire les plugins pour charger les modules de donnees"); + // ------------------------------------------------------------------------- + // sgbd + // + + $sgbd_impl_file = $this->path("mw_dir")."env/sgbd/mw_".$this->bdd("sgbd").".php"; + if($this->bdd("sgbd")){ + 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); } - else $this->erreur("Impossible de trouver la classe d'implementation du sgbd ".$this->bdd("sgbd"), true); } - else $this->erreur("Impossible de trouver le fichier d'implementation du sgbd ".$this->bdd("sgbd"), true); -?> \ No newline at end of file + // ------------------------------------------------------------------------- + // data + // + + if(($plugins = $this->plugins("DESC")) === false){ + $this->erreur("Impossible de lire les plugins pour charger les modules de donnees", true); + } + $data = new mw_data(true); + foreach($plugins as $plugin_name => $plugin){ + if($plugin["installed"] && $plugin["enabled"]){ + $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/share/"); + if($this->bdd("sgbd")){ + $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); + } + } + } + $data->load_modules($this->path("mw_dir")."app/", "data/modules/share/"); + if($this->bdd("sgbd")){ + $data->load_modules($this->path("mw_dir")."app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); + $data->set_sgbd($sgbd); + } + $data->set_env($this); + $this->set_data($data);